search_api_attachments_entity_view() assumes the entity is a node

Created on 3 June 2025, 10 days ago

Problem/Motivation

hook_entity_view() is for any entity, and SearchAPI allows indexing all types of content entities.

However, the implementation of the hook, search_api_attachments_entity_view(), assumes the field for the entity ID is a node nid:

          ($query = \Drupal::entityTypeManager()
            ->getStorage('search_api_index')
            ->load($index->id())
            ->query()
          )
            ->addCondition('nid', $entity->id());

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

10.0

Component

Code

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024