Issue #3579758: Provide API for access checks on non-content entities
Prior to this change, the AI Search backend only supported access checks for content entities by hardcoding the entity load and access checks for items prefixed with entity:.
This commit introduces a flexible API to support access checks across all types of Search API datasources (including custom, non-content entities).
Changes included:
- Added
hook_ai_search_item_accesstoai_search.api.phpto allow modules to explicitly allow or forbid access to specific search items. - Refactored
SearchApiAiSearchBackend::checkEntityAccess()tocheckItemAccess(). - Updated access logic to evaluate combined access results in the following order:
- Custom module overrides via
hook_ai_search_item_access. - The Search API datasource's native
getItemAccessResult()method. - Legacy fallback for content entities (checking
$entity->access('view')) to preserve backward compatibility.
- Custom module overrides via
- Defaulted access to
FALSEfor non-entity datasources if they are not explicitly allowed by the hook or the datasource.
Closes #3579758