Problem/Motivation

From Rajab.

Some module are altering field formatters with hook_field_formatter_third_party_settings_form and hook_preprocess_field

Examples:

Proposed resolution

Are we compatible with them?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pdureau created an issue. See original summary.

pdureau’s picture

oldeb’s picture

Assigned: Unassigned » oldeb
pdureau’s picture

Issue summary: View changes
pdureau’s picture

Title: [2.0.0-beta5] Check hook_field_formatter_third_party_settings_form compatibility » [2.0.0-rc1] Check hook_field_formatter_third_party_settings_form compatibility

Moved to RC1

oldeb’s picture

Status: Active » Closed (works as designed)

Both mentionned modules seems to work as intended.

The only thing I noted is that when using a field formatter to render the field inside a component's slot, the "Remove field markup" option is not there but that don't seems like a bug to me.

pdureau’s picture

Status: Closed (works as designed) » Reviewed & tested by the community

Thanks Olivier.

when using a field formatter to render the field inside a component's slot, the "Remove field markup" option is not there but that don't seems like a bug to me.

So, when using a field formatter to render the field inside a component's slot, field_formatter_range works but no nomarkup? If yes, we can close the issue.

So, when using a field formatter to render the field inside a component's slot, field_formatter_range doesn't work? If yes, we have to investigate

pdureau’s picture

Status: Reviewed & tested by the community » Needs work
oldeb’s picture

I confirm that when displaying a formatter inside a component slot, neither of field_formatter_range or nomarkup is working.

We should definitively investigate more.

pdureau’s picture

Assigned: oldeb » Unassigned

So, we don't trigger hook_field_formatter_third_party_settings_form in our Field Formatter Source plugin for slots. We need to trigger it.

Careful, there is maybe another hook to check at render time (field_formatter_range_preprocess_field?).

Olivier's job is done here. Who is taking the subject?

smovs’s picture

Assigned: Unassigned » smovs
smovs’s picture

Assigned: smovs » Unassigned
just_like_good_vibes’s picture

Assigned: Unassigned » just_like_good_vibes

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » pdureau
Status: Needs work » Needs review

i updated the code, would you test again?

pdureau’s picture

Assigned: pdureau » just_like_good_vibes
Status: Needs review » Needs work

It works when I'm at the first level, when my formatter is the consumer plugin:

  field_tags:
    type: ui_patterns_component_per_item
    label: above
    settings:
      ui_patterns:
        component_id: 'ui_suite_dsfr:button'
        slots:
          label:
            sources:
              -
                source:
                  type: entity_reference_label
                  third_party_settings:
                    field_formatter_range:
                      order: '0'
                      limit: '0'
                      offset: '0'
                  settings:
                    link: 0
                source_id: 'field_formatter:node:article:field_tags'
    third_party_settings:
      field_formatter_range:
        order: 0
        limit: 3
        offset: 1

✅ I see only the 2nd, the 3rd and the 4th items.

But it doesn't work at deeper levels when the formatter is itself a slot source plugin.

pdureau’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Needs work » Fixed

A follow up issue will be created for the remaining fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.