Views search row plugin is always available

Created on 4 January 2015, almost 10 years ago
Updated 18 December 2023, about 1 year ago

Problem/Motivation

The 'Search Results' row plugin is always available, regardless of the display type. This should work correctly with display type filtering.

E.g.

If you try to use this in a feed view, it will break too.

Steps to reproduce

  1. Go to Structure > Views > Taxonomy term > Edit > Feed
  2. Select the link "Show: Content"
  3. Expected: The "Search results" format should not be available.
  4. Actual: The option is available, and the resulting preview prints invalid markup containing ArrayArray

The same issue can also be seen for pagers right now. Again, on the feed display, all pagers are available whereas only 'basic' ('Display all items' and 'Display a specified number of items') type pagers should be available as usesPager() for the display is false.

Proposed resolution

Add a 'display_types' default value of ['normal'] to the ViewsPluginManager defaults. This will improve DX (otherwise you will always have to specify at least display_types = {"normal"} in your annotations).

We need to do this after the regular default values have been merged. Otherwise we will get arrays being concatenated during the deep merging. I.e. 'normal' will be added to every display_types array.

This can then be overridden like RestExport or Feeds do, or set to NULL if no type really is desired (this will be rare).

Remaining tasks

User interface changes

None

API changes

None

<!--<tr><th><a href="https://www.drupal.org/core/beta-changes#prioritized">Prioritized changes</a></th><td>The main goal of this issue is usability/accessibility/security/performance/removing code already deprecated for 8.0.0/Migrate. (Which? Specify.)</td></tr>--><!--<tr><th><a href="https://www.drupal.org/core/beta-changes#disruption">Disruption</a></th> <td>Disruptive for core/contributed and custom modules/themes because it will require a BC break/deprecation/data model changes/an upgrade path/internal refactoring/widespread changes... (Which? Specify.)</td></tr>-->
πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Views UIΒ  β†’

Last updated 17 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom damiankloip

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Patch #34 still applies to 11.x with slight fuzz but would be good to get this into MR form.

    Before that happens though I think we still need an answer for #39

  • Merge request !5820Hide irrelevant options in styles β†’ (Open) created by Lendude
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    The current fix changes way more than just the row plugins, as pointed out in the IS, this also affects things like pagers. This isn't necessarily a bad thing but we do need to check if we are not hiding things we don't want hidden and maybe expand the test coverage to also cover other plugin types.

    For #39, I don't think plugins that have display_types = {"normal"} set need to change anything, it just becomes redundant, because we are adding display_types = {"normal"} for all plugins that don't set anything. I think....

    But yeah changing this in ViewsPluginManager feels a little bit more invasive than it did when this was opened, I feel we do need a clearer list of all affected plugin types if we do it in ViewsPluginManager

Production build 0.71.5 2024