Problem/Motivation

On a site running Field Group 4.x + Field Group Markup 1.0.3, loading any page that triggers the Markup
formatter class — including the Manage Form Display screen and any entity edit form that contains a markup
group — produces a fatal PHP error:

Fatal error: Declaration of
  Drupal\field_group_markup\Plugin\field_group\FieldGroupFormatter\Markup::settingsForm() must be compatible
  with Drupal\field_group\FieldGroupFormatterBase::settingsForm(array $form,
  Drupal\Core\Form\FormStateInterface $form_state) in
  .../field_group_markup/src/Plugin/field_group/FieldGroupFormatter/Markup.php on line 63

Steps to reproduce

  1. Install drupal/field_group:^4.0 and drupal/field_group_markup:^1.0.
  2. On any entity (e.g. User), add a field group with format Markup.
  3. Visit the Manage Form Display screen, or visit an entity edit form rendering that group.
  4. Observe the fatal error.

Root cause

In field_group 4.x, FieldGroupFormatterBase::settingsForm() declares the
signature (array $form, FormStateInterface $form_state). Markup::settingsForm()
declares no arguments, which is incompatible under PHP 8.x strict inheritance checks.

Proposed resolution

Update Markup::settingsForm() to accept the same arguments as its parent and pass them
through:

use Drupal\Core\Form\FormStateInterface;

  public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);
    // ...rest unchanged
  }

The body of the method already builds the form from scratch, so the new $form argument
simply replaces the local variable — no behavioral change.

Remaining tasks

  • Review MR.
  • Tag a 1.0.4 release once merged.
CommentFileSizeAuthor
#3 3589931.patch874 bytescolan
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

colan created an issue. See original summary.

colan’s picture

Status: Active » Needs review
StatusFileSize
new874 bytes

Please review MR, but here's a patch for Composer.

  • colan committed 01519535 on 1.0.x
    Issue #3589931 by colan: Fix Markup::settingsForm() signature for Field...
dieuwe’s picture

Status: Needs review » 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.

dieuwe’s picture

Thanks for the detailed issue and fix, I have tagged a new release.

ichthus’s picture

On Friday 15/05 14:57 GMT (UTC+!)
I installed Field Group Markup 1.0.4, and this produced the error -

Fatal error: Declaration of Drupal\field_group_markup\Plugin\field_group\FieldGroupFormatter\Markup::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) must be compatible with Drupal\field_group\FieldGroupFormatterBase::settingsForm() in /var/www/urc5-mirror/web/modules/contrib/field_group_markup/src/Plugin/field_group/FieldGroupFormatter/Markup.php on line 64

making all content types using field_group_markup unusable.
I had to downgrade quickly.

I had (and have) no issues with 1.0.3!

I am using Drupal 10.6.8 ; PHP 8.4.21

Also tested using Drupal 11.3.11 PHP 8.4.21 on 31/06/2026 17:06 GMT+1
and it failed.

I am assuming that 1.0.4 was supposed to fix this.
Am I right?

Thanks

maxmendez’s picture

I’m experiencing the same issue.

Fatal error: Declaration of Drupal\field_group_markup\Plugin\field_group\FieldGroupFormatter\Markup::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) must be compatible with Drupal\field_group\FieldGroupFormatterBase::settingsForm() in /var/www/urc5-mirror/web/modules/contrib/field_group_markup/src/Plugin/field_group/FieldGroupFormatter/Markup.php on line 64

The problem appears to be caused by the patch making the module compatible with Field Group 4.1.0-alpha2, which introduced changes in FieldGroupFormatterBase.php. However, the patch also removes compatibility with the current stable 4.0.0 branch.

In the stable 4.0.0 release, the settingsForm() method does not include the additional parameters introduced in the alpha version, so applying this patch causes a method signature mismatch when using the stable branch.

kgaut’s picture

Same issue that #9 for me, had to downgrade to 1.0.3

Status: Fixed » Closed (fixed)

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

deadpoet’s picture

We had the same problem as described in #9 as well, had to downgrade to 1.0.3.

4kant’s picture

Same here: had to downgrade:
composer require 'drupal/field_group_markup:1.0.3'

This issue should be reopened.

justcaldwell’s picture

This change makes field_group_markup compatible with the 4.1 branch of Field Group (which is still alpha). It broke compatibility with Field Group 4.0, the stable, recommended release.

The signature change occurred in this commit (which is only in the 4.1 branch).

This should be reverted and, if desired, applied to a new branch/release that targets Field Group 4.1.

justcaldwell’s picture