Error adding group content menu paragraph to group entity

Created on 2 September 2025, about 2 months ago

Problem/Motivation

We're using paragraphs to allow users to add a group content menu block to their content. This works fine for node entities. Though, when trying to add a group content menu block to a group entity we get the following error.

LogicException: The machine name element ...[advanced][theme_hook_suggestion... is defined before the source element label, it must be defined after or the source element must specify an id. in Drupal\Core\Render\Element\MachineName::processMachineName()

I can appreciate that adding a group content menu block to a group entity with parapraphs is probably a bit of an edge case.

Steps to reproduce

I'm not entirely sure how the other members of our team have set up paragraphs, though if any one has specific questions I'd be happy to look into it.

Proposed resolution

I've done some experimenting with blockForm in src/Plugin/Block/GroupMenuBlock.php. If I remove $form['advanced']['theme_hook_suggestion'] the error goes away, though with obvious drawbacks.

I've also made a half-hearted effort to add a $form['advanced']['label'] element to the form and pointed $form['advanced']['theme_hook_suggestion']['#machine_name']['source'] to it. The results we're promising, but rather than dig deeper I thought it best to come here with the issue.

After a cursory glance at the other implementations of the machine_name element in core and the other modules we have installed, it appears to me that group_content_menu's implementation may be non-standard. I wonder if this variation is strictly necessary and if it is perhaps the root of my current problem.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024