nuvoleweb / ui_patterns

[NOTE] Development has moved to https://drupal.org/project/ui_patterns
https://drupal.org/project/ui_patterns
GNU General Public License v2.0
85 stars 56 forks source link

Pattern::isFieldVisible returns false on valid mappings by using field instead of id #338

Open pvbergen opened 2 years ago

pvbergen commented 2 years ago

Drupal\ui_patterns_views\Plugin\views\row\Pattern::isFieldVisible returns false on valid mappings. This is caused by using different identifiers for mapping and visiblity check.

Problem

These values are usually the same in views, but don't have to be. This can cause fields to not be passed to patterns.

How to reproduce

We had this bug with the field "Published on" provided by drupal/publication_date.

  1. Install ui_patterns_view and publication_date
  2. Create a view, inserting the field "Published on" twice or more.
  3. Check the view config: It will show different values for id and field on all but the first field plugin

Sample from a view config

fields: published_at: id: published_at table: node_field_data field: published_at published_at_1: id: published_at_1 table: node_field_data field: published_at published_at_2: id: published_at_2 table: node_field_data field: published_at

Solution

Pass field id to isFieldVisible along with field. See changes in the PR.