🇧🇪Belgium @steven.d

Account created on 17 June 2011, over 13 years ago
#

Recent comments

🇧🇪Belgium steven.d

We had this same issue, and after quite a bit of detective work I've figured out what caused it (in our case).

Our situation:
We have a "Content select" view (which is used by an entity browser to add page teasers in a layout builder block via entity reference field). This view has a display, lets call it "Display A", that uses a 'Card' pattern for it's row display, and has the following fields, mapped to the pattern.

  • Content: Entity browser bulk select form
  • Content: Featured image (field_featured_image)
  • Content: Title
  • Content: Teaser

After a colleague recently added a new display "Display B" to this view, our initial Display A no longer worked. When the entity browser modal was opened, the above error would be shown in the modal.

Display B is a copy of Display A, but includes a new field, Content: Image (field_image) which was specifically added only to this display, because it lists a content type that doesn't use field_featured_image.

However, when checking with xdebug, if found out that when Display A was displayed, the foreach at line 42 of ui_patterns/modules/ui_patterns_views/ui_patterns_views.module also included field_image as one of the fields. Since that field does not exist on this display, which results in the error.

However, reviewing the pattern mapping of the row display via the Views UI showed nothing wrong. There was no mention of field_image, or any mapping for it. And it wasn't mentioned in the Default display either.

So what was wrong? It took a while to figure out, but this is where the problem lies:

When the new display was created, and the new field was added to it, my colleague mapped field_image to a region in the pattern in the settings of the Pattern row display. However, he did not set the row display itself to the "this display override", so the mapping of field_image to the pattern region was saved for "All displays".

Visually, in views UI, each display's row settings seem fine (because in Display A, field_image is not show as an option to map to the pattern), but the mapping still exists for that display because it was saved to the defaults for the whole view.

So to reproduce:

  1. Create content type A with field X
  2. Create content type B with field X and Y
  3. Create a view.
  4. Make a display, that lists content type A, and set it rows style to pattern, and map field X to one of the regions in the settings.
  5. Clone the display, make it list content type B, add field Y as an override for that display's fields. Go to the row style settings, and map field Y to one of the regions of the patterns. (Make sure not to make that an override, but keep it for all displays"
  6. Visit the first view, it should throw the error.

The patch in #2 fixes the error preventing the view from being displayed, but will still throw the following warning:

Warning: Undefined array key "field_image" in template_preprocess_pattern_views_row() (line 44 of modules/contrib/ui_patterns/modules/ui_patterns_views/ui_patterns_views.module).

🇧🇪Belgium steven.d

Created a patch for this that allows you to select 'Step' amount (using the same values of the soft limit) in a facet's settings.
Every interaction with the show more link will reveal additional items equal to the step setting.
When all items are revealed, interacting with the show less link will hide all items over the soft limit (going back to the initial state).

Production build 0.71.5 2024