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 generating search results that include external datasources (those that aren't Drupal entities), the code to generate the results causes a fatal error due to the fact that the entity type does not exist in Drupal.
The interface for a datasource requires a viewItem method that can take the place of the exception-causing code and generate the desired output for both entities and non-entities. A patch is attached.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2846103-7.patch | 637 bytes | legolasbo |
| |||
#3 | 2846103-3.patch | 846 bytes | legolasbo |
| |||
searchApiPageResult.patch | 885 bytes | ChrisGrewe | |
Comments
Comment #2
borisson_I'm not sure about this. This makes the controller not use entity rendering anymore. So that would be a regression vs the current behavior.
Comment #3
legolasboIt looks like the viewItem method actually does render the entity using entity rendering, but falls back to an empty array if that's not possible. The suggested change would make things more robust if that's actually the case, so let's see what testbot thinks of it, but with a correct patch this time.
Comment #4
legolasboTestbot doesn't seem to mind. What do you think borisson_?
Comment #5
borisson_Testbot here isn't to be as trusted as in the Search API module, but it does look good. I forgot about
viewItem
's behavior.Comment #6
borisson_This patch no longer applies
Comment #7
legolasboRerolled
Comment #8
borisson_Back to RTBC, will commit over the weekend or during dev days.
Comment #10
borisson_Committed and pushed, thanks!
Comment #11
borisson_