Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When relationship support was added, entity fields were moved to the $row['_entity_properties']
array. However, the line that checks for missing fields was not changed to check this array. This feature simplifies working with some external data sources, so it would be nice if it worked.
Comment | File | Size | Author |
---|---|---|---|
#1 | missing-fields-2414367.patch | 1020 bytes | Darren Oh |
Comments
Comment #1
Darren OhComment #2
Darren OhComment #3
drunken monkeyThanks for spotting this! Can't believe we missed this …
However, it's actually pretty inconsequential, as far as I can see, as
$this->fields
will always be an empty array (unless I'm mistaken). As noted in the doc comment ofextractFields()
, field handlers now load their (missing) data themselves. (They also wouldn't even know how to add fields to a Search API Views query, I guess, since they aren't Search API-specific anymore.)Which raises the question of why the whole code stayed there in the first place – but I guess we can just leave it there for now and do a better/cleaner job in D8, instead of having to figure out now what parts of that code actually still serve a purpose.
Anyways, patch committed. Thanks again!
Comment #5
Darren OhThanks for fixing this. It was consequential for me because I am working with an external API which I cannot change. I populated
$this->fields
by using the view query’s addField method in hook_search_api_views_query_alter(). I suppose I could have overridden the handler for each field type inhook_entity_views_field_handlers_alter()
instead, but that seems needlessly complicated.