Some rendering features of a field in views are not available when using Component (UI Patterns) format

Created on 20 September 2024, 12 months ago

Problem/Motivation

I build a view to render some content (nodes). This view uses the format Component (UI Patterns). I set up some fields in the view and select a component to render these fields. For slots of the component, I use View field and select the appropriate field to place in slots.

I would like to add a label for a field, but this label is not displayed in the prop that is using this view field. I also added some style settings for field, and did not see these styles to be applied. But the rewrite results settings worked for fields.

These are some screenshots about my set up

For header slot, I use the view field Title

For the field Title, I added a label

As a result, I didn't see the label of the title field is displayed in the slot header of the component.

Expected Behaviours

All the field configurations should be preserved when it is placed in component's slots.

πŸ› Bug report
Status

Active

Version

2.0

Component

UI Patterns Views

Created by

πŸ‡ΊπŸ‡ΈUnited States sea2709 Texas

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

Comments & Activities

  • Issue created by @sea2709
  • πŸ‡«πŸ‡·France pdureau Paris

    Hi

    Thanks for your issue

    First test: Component in formatters

    With:

    • Unformatted list as View style
    • Field as View row
    • "Label test" as title field label

    It looks OK, I see the Label test at every row.

    <div class="views-element-container contextual-region">
      <div class="views-row">
        <div class="views-field views-field-title">
          <span class="views-label views-label-title">Label test</span>
          <span class="field-content">
            <button data-component-id="ui_suite_bootstrap:button" class="btn-primary btn" type="button">First article</button>
          </span>
        </div>
      </div>
      <div class="views-row">
        <div class="views-field views-field-title">
          <span class="views-label views-label-title">Label test</span>
          <span class="field-content">
            <button data-component-id="ui_suite_bootstrap:button" class="btn-primary btn" type="button">Second article</button>
          </span>
        </div>
      </div>
    </div>
    

    However, this is not exactly what you are testing here, so let's do a second test.

    Second test: Component in view row

    With:

    • Unformatted list as View style
    • Plain text as title field formatter
    • "Label test" as title field label

    Before the test, I need to wait for this fix: πŸ› [2.0.0-beta3] Bug in view row style plugin using views field source Active

    To be continued...

    array_keys(): Argument #1 ($array) must be of type array, null given

  • Assigned to pdureau
  • Status changed to Postponed 12 months ago
  • πŸ‡«πŸ‡·France pdureau Paris
  • πŸ‡ΊπŸ‡ΈUnited States sea2709 Texas

    Thanks for looking into this.

    I confirm your first test works on my end too. I did some tricks to overcome to the issue you mentioned πŸ˜… , anyway, I saw a fix for that issue and it worked. I tried again to put a label, but it doesn't show up!

  • πŸ‡«πŸ‡·France pdureau Paris

    πŸ› [2.0.0-beta3] Bug in view row style plugin using views field source Active was merged, so we can test "Component in view row"

  • πŸ‡«πŸ‡·France pdureau Paris

    Ok, i reproduced the issue, with:

    • Unformatted list as View style
    • "Component (UI Patterns)" as View row
    • Plain text as title field formatter
    • "Label test" as title field label

    In Drupal\ui_patterns_views\Plugin\UiPatterns\SourceViewFieldSource::getPropValue(), we take the field value from $view->style_plugin->getField($row_index, $field_name) without taking the full views_view_field renderable (with label & wrappers)

  • πŸ‡«πŸ‡·France pdureau Paris

    Maybe in beta4, maybe out of scope

  • πŸ‡«πŸ‡·France pdureau Paris
  • Issue was unassigned.
  • πŸ‡«πŸ‡·France just_like_good_vibes PARIS

    we need to take a decision on that one, we move to 2.1.x ?

  • πŸ‡«πŸ‡·France pdureau Paris

    OK for 2.1

  • Status changed to Active 4 months ago
  • πŸ‡«πŸ‡·France pdureau Paris
  • πŸ‡ΊπŸ‡ΈUnited States dalemoore

    I just ran into this issue as well, and can confirm that using the "rewrite results" method is a decent workaround for now. I just set it up how I wanted in both sections, under Style Settings and under Rewrite Results. I'll be able to disable the rewrites once it's fixed in UI Patterns. πŸŽ‰

Production build 0.71.5 2024