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
- Install
drupal/field_group:^4.0anddrupal/field_group_markup:^1.0. - On any entity (e.g. User), add a field group with format Markup.
- Visit the Manage Form Display screen, or visit an entity edit form rendering that group.
- 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3589931.patch | 874 bytes | colan |
Issue fork field_group_markup-3589931
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 #3
colanPlease review MR, but here's a patch for Composer.
Comment #5
dieuweComment #7
dieuweThanks for the detailed issue and fix, I have tagged a new release.
Comment #8
ichthus commentedOn Friday 15/05 14:57 GMT (UTC+!)
I installed Field Group Markup 1.0.4, and this produced the error -
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
Comment #9
maxmendez commentedI’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.
Comment #10
kgaut commentedSame issue that #9 for me, had to downgrade to 1.0.3
Comment #12
deadpoet commentedWe had the same problem as described in #9 as well, had to downgrade to 1.0.3.
Comment #13
4kant commentedSame here: had to downgrade:
composer require 'drupal/field_group_markup:1.0.3'
This issue should be reopened.
Comment #14
justcaldwellThis 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.
Comment #15
justcaldwellI just opened #3612052: Regression: 1.0.4 breaks compatibility with Field Group 4.0 as a follow-up to this.