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
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3588233-settingsForm.patch | 1.07 KB | muffinzap |
Issue fork field_group_link-3588233
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
Comment #2
rodrigoaguileraThanks 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
Comment #3
muffinzap commentedComment #4
muffinzap commentedComment #9
rodrigoaguileraI 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?
Comment #10
muffinzap commentedComment #12
rodrigoaguileraI verified that it works with 4.1.0-alpha1 so I release 3.4-alpha1 please test and confirm it works