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

view

For header slot, I use the view field Title
Header Slot

For the field Title, I added a label
Configure title field

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.

Comments

sea2709 created an issue. See original summary.

pdureau’s picture

Title: Some rendering features of a field in views are not available when using Component (UI Patterns) format » [2.0.0-beta3] Unavailable field features when using components as view rows
Status: Active » Postponed

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: #3475574: [2.0.0-beta3] Bug in view row style plugin using views field source because

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

To be continued...

pdureau’s picture

Assigned: Unassigned » pdureau
sea2709’s picture

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!

just_like_good_vibes’s picture

just_like_good_vibes’s picture

Assigned: pdureau » christian.wiedemann
Status: Postponed » Needs review
pdureau’s picture

pdureau’s picture

Assigned: christian.wiedemann » Unassigned
Status: Needs review » Needs work

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)

pdureau’s picture

Title: [2.0.0-beta3] Unavailable field features when using components as view rows » [2.0.0-beta4] Unavailable field features when using components as view rows
Status: Needs work » Postponed

Maybe in beta4, maybe out of scope

pdureau’s picture

Title: [2.0.0-beta4] Unavailable field features when using components as view rows » [2.0.0-beta5] Unavailable field features when using components as view rows
just_like_good_vibes’s picture

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

just_like_good_vibes’s picture

Title: [2.0.0-beta5] Unavailable field features when using components as view rows » [2.1.x] Unavailable field features when using components as view rows
Status: Postponed » Active
pdureau’s picture

OK for 2.1

pdureau’s picture

Category: Bug report » Feature request
dalemoore’s picture

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. 🎉

just_like_good_vibes’s picture

Assigned: Unassigned » pdureau

Pierre, let's check that issue please. In my opinion, we will keep providing value-only.

just_like_good_vibes’s picture

Status: Active » Needs review