Problem/Motivation

After applying the field_group patch from issue #3495221
("Add $form and $form_state parameters to formatter plugins' settingsForm method"),
Drupal throws a fatal error:

Fatal error: Declaration of
Drupal\field_group_link\Plugin\field_group\FieldGroupFormatter\Link::settingsForm()
must be compatible with
Drupal\field_group\FieldGroupFormatterBase::settingsForm(array $form,
Drupal\Core\Form\FormStateInterface $form_state) in
/web/modules/contrib/field_group_link/src/Plugin/field_group/FieldGroupFormatter/Link.php
on line 116

This is because the `Link` formatter class in `field_group_link` still uses the
old `settingsForm()` signature without parameters, while `field_group` has updated
`FieldGroupFormatterBase::settingsForm()` to require `array $form` and
`FormStateInterface $form_state` parameters.

Steps to reproduce

1. Apply patch #3495221 to `drupal/field_group`
2. Have `drupal/field_group_link` installed
3. Clear cache
4. Navigate to any Manage Display page that uses the Link field group formatter

Proposed resolution

Update `Link::settingsForm()` signature and parent call to match the new
`FieldGroupFormatterBase` signature:

// Before
public function settingsForm() {
  $form = parent::settingsForm();

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

Related issues

- field_group #3495221: Add $form and $form_state parameters to formatter plugins'
settingsForm method

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

muffinzap created an issue. See original summary.

rodrigoaguilera’s picture

Version: 8.x-3.3 » 8.x-3.x-dev
Status: Active » Needs work

Thanks for raising the issue

Please open an MR and follow the code standards like
FormStateInterface $form_state
with a "use" statement at the beggining of the file

muffinzap’s picture

muffinzap’s picture

StatusFileSize
new1.07 KB

muffinzap changed the visibility of the branch 3588233-fieldgrouplink-link-formatter to hidden.

rodrigoaguilera’s picture

I looked a bit more into the field_group issue and it is only released in 4.1.0-alpha1
So I think it should be also released as an alpha on this side.

Any reason you created the MR as draft?

muffinzap’s picture

Issue summary: View changes

rodrigoaguilera’s picture

Status: Needs work » Fixed

I verified that it works with 4.1.0-alpha1 so I release 3.4-alpha1 please test and confirm it works

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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