Problem/Motivation

I understand that version 1 of the module is treated as legacy, but in our case we're still using it on one of our projects.

On Drupal 11 with field_group ^4.1@alpha installed, any node edit form that includes a field group using the "Pattern" (ui_patterns_field_group) formatter fails with:

Declaration of Drupal\ui_patterns_field_group\Plugin\field_group\FieldGroupFormatter\PatternFormatter::settingsForm() must be compatible with Drupal\field_group\FieldGroupFormatterBase::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) in .../ui_patterns_field_group/src/Plugin/field_group\FieldGroupFormatter/PatternFormatter.php on line 194

field_group changed FieldGroupFormatterBase::settingsForm() to accept $form and $form_state parameters in issue #3495221. ui_patterns_field_group's PatternFormatter overrides settingsForm(), so it needs updating as well to match it.

Steps to reproduce

1. Install Drupal 11 with drupal/field_group ^4.1@alpha and drupal/ui_patterns 1.x.
2. Configure a "Manage form display" field group to use the "Pattern" format (ui_patterns_field_group's PatternFormatter).
3. Visit the edit form for any entity using that form display.
4. Check that the exception above occurs.

Proposed resolution

Update PatternFormatter::settingsForm() to match the updated FieldGroupFormatterInterface::settingsForm(), and pass $form and $form_state through to the parent call:

  use Drupal\Core\Form\FormStateInterface;
  ...
  public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);
    ...

API changes

PatternFormatter::settingsForm() signature changes from settingsForm() to settingsForm(array $form, FormStateInterface $form_state), matching the FieldGroupFormatterBase/Interface.

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

gueguerreiro created an issue. See original summary.

gueguerreiro’s picture

Assigned: gueguerreiro » Unassigned
Status: Active » Needs review

Opened an MR with a fix, if it helps anybody in the same situation.

pdureau’s picture

Assigned: Unassigned » duaelfr

Hi @duaelfr I guess it is your scope ;)

pdureau’s picture

Assigned: duaelfr » Unassigned
Status: Needs review » Needs work

But first @gueguerreiro can you make the pipeline green before review?

https://git.drupalcode.org/issue/ui_patterns-3612514/-/jobs/11092706