Problem/Motivation

The \Drupal\field_group\FieldGroupFormatterInterface::settingsForm() methods are called in two different contexts:

  1. when creating the field group, by the \Drupal\field_group\Form\FieldGroupAddForm form
  2. when editing an existing field group, by the field_group_format_settings_form() function called within the field_group_field_ui_display_form_alter() hook implementation

In the edition context, $form and $form_state are passed to the settingsForm method, which is not a problem for PHP that accepts more arguments than defined in method calls.
In the creation context, these arguments are not passed to the settingsForm method.

As the \Drupal\field_group\FieldGroupFormatterInterface::settingsForm() method description does not include these parameters, one specific implementation cannot declare them without throwing a fatal error.

In some specific contrib cases (like UI Patterns Field Group or SDC Display modules implementations), having these parameters declared would be a good thing, even if your core formatters don't use them.

Proposed resolution

Add these parameters in \Drupal\field_group\FieldGroupFormatterInterface::settingsForm() method description and all field_group implementations.

Remaining tasks

Code and documentation.

API changes

New parameters on \Drupal\field_group\FieldGroupFormatterInterface::settingsForm().
Interface changes might break existing contrib/custom field group formatters.
This might be the appropriate time to do this before beta1!

CommentFileSizeAuthor
#4 3495221-4.patch9.72 KBduaelfr
#3 3495221-3.patch9.23 KBduaelfr
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

duaelfr created an issue. See original summary.

duaelfr’s picture

Status: Active » Needs review
StatusFileSize
new9.23 KB

Attaching patch for composer

duaelfr’s picture

StatusFileSize
new9.72 KB

You can call me stupid :D
MR and patch updated with the most important part

rosk0 made their first commit to this issue’s fork.

rosk0’s picture

Status: Needs review » Reviewed & tested by the community

Changed look sensible, pipeline is green and I can use field group with components thanks to this and @duaelfr.

anybody’s picture

Thanks for the important fix!

anybody’s picture

Status: Reviewed & tested by the community » Fixed

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.

  • anybody committed 4ae4f65a on 4.x authored by duaelfr
    Issue #3495221: Add $form and $form_state parameters to formatter...

Status: Fixed » Closed (fixed)

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