Don't use strict comparison on Form API elements

Created on 31 March 2025, 7 days ago

Problem/Motivation

\Drupal\group_content_menu\Form\GroupContentMenuForm::submitOverviewForm() uses a strict comparison when checking whether the weight, parent or enabled fields were changed, and this is problematic for the enabled field because it checks a #default_value = TRUE to #value = 1.

Note that core's menu form doesn't use a strict comparison in \Drupal\menu_ui\MenuForm::submitOverviewForm() for the same reason.

Steps to reproduce

The easiest way to reproduce this is with the Workspaces module:

- reorder some child menu items in a workspace
- save the form
- navigate to the workspace overview page and notice that all menu links are now updated, not just the siblings of the reordered item

Proposed resolution

Use a non-strict comparison, just like the core menu form.

Remaining tasks

Review.

User interface changes

Nope.

API changes

Nope.

Data model changes

Nope.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇷🇴Romania amateescu

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024