Selecting the 'Rendered entity' display style when creating a view that's not based on a search index causes a crash:

> InvalidArgumentException: View test resources listing view mode is not based on Search API but tries to use its row plugin. in Drupal\search_api\Plugin\views\row\SearchApiRow->init() (line 122 of modules/search_api/src/Plugin/views/row/SearchApiRow.php).

Similarly, selecting it on an existing view causes the modal dialog to do nothing, presumably because of the same crash.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

drunken monkey’s picture

Component: General code » Views integration

That's very curious. Normally, this option shouldn't appear except for Search API views, and I also cannot reproduce this. Have you tried clearing the cache?

joachim’s picture

The option appears in the initial wizard to create a new view.

drunken monkey’s picture

Can't reproduce it there, either. For me, those options change according to the base table I pick, and are the same as later when editing the view.
Did you try with the latest version of Views? Or do you maybe have Javascript turned off? (Would be a Views bug, then, though.)

kevinwal’s picture

Can confirm: Created new view. Set to rendered entity and modal provides a 500 - is not based on Search API but tries to use its row plugin.

ayalon’s picture

We have the same issue here. Did not find a solution yet except using Display Suite and selecting the viewmode in the display suite Views Plugin.

joachim’s picture

> We have the same issue here. Did not find a solution yet except using Display Suite and selecting the viewmode in the display suite Views Plugin.

You don't have the same issue then. The issue here is that the 'Rendered entity' display style *should not* show in the list, because it's only compatible with a view based on a Search API index.

damontgomery’s picture

I just saw this issue as well. To select a view mode for a Taxonomy based view, I select "Taxonomy Term" as the Row style. The "Rendered Entity" was an option that produced the error noted above. I thought that's what I should pick since I wanted to select a view mode for the terms. For our case, I can just choose the right option and move along.

If other people encounter this bug, you probably are looking for the other row styles that let you pick a view mode.

Nigel Cunningham’s picture

I'm seeking to make a view of paragraph content. The bug occurs in my case because Views::fetchPluginNames('row', 'normal', [ 'paragraphs_item_field_data' ]) matches the search_view plugin. Plugin['display_types'] is not set and plugin['base'] is not set so it gets added to the list of plugins that are returned.

BrightBold’s picture

This still exists in Drupal 8.7.1. I created a view of Media (image type) and got this error after choosing rendered entity as the display format. Per other comments here, changing the display format eliminates the error.

It would definitely be good if invalid plugins weren't offered up. But great that there was an easy workaround.

drunken monkey’s picture

Very strange. This should actually already be taken care of by our search_api_views_plugins_row_alter() hook implementation, which just adds our own base tables as possible bases for the row plugin.
Or, hm, do you maybe just not have any search index set up (yet), so this comes out as an empty array and gets ignored by Views? Hadn’t thought of that. If that’s the cause, the attached patch should help – please test!

Or do you have a new search index and didn’t clear cache since then? Then just try clearing cache – maybe that’s the problem. (This should already be taken care of, too, I think, but can’t hurt to try.)

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

That does the trick, thank you @drunken monkey

  • drunken monkey committed 02237ac on 8.x-1.x
    Issue #2718045 by drunken monkey, joelpittet: Fixed "Rendered entity"...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Excellent, thanks a lot for your feedback!
Committed.

hsponner’s picture

@drunken monkey, thanks. Works for me, too.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

pfrenssen’s picture

It looks like this solution is not correct. It is now impossible to install modules that depend on Search API and have exported Views config that use our Views caching plugins. The following error is thrown when installing the module:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "search_api_tag" plugin does not exist. Valid plugin IDs for Drupal\views\Plugin\ViewsPluginManager are: time, tag, none

Edit: there was already an issue for this: #3071591: Search_api plugin not exists after updating 8.1.13 to 8.1.14.

I have proposed a patch there that solves the problem.