NodeFormAlter.php issue when site is in Read Only Mode (not set $form['actions'])

Created on 12 November 2024, 3 months ago

Problem/Motivation

When a site is set to read only via readonlymode ( https://www.drupal.org/project/readonlymode β†’ ) the $form['actions'] array is unset to prevent submitting forms.

NodeFormAlter.php:187 attempts to add form validation to forms via $form['actions']. They have already been unset though by readonlymode, and so array_values() complains that:

TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 190 of modules/contrib/group_content_menu/src/NodeFormAlter.php).

Steps to reproduce

-Install readonlymode and group_content menu
-Enable read only mode
-Attempt to create a node in a group, as a user without the permission "Access all forms while in Read Only Mode"
-See error

Proposed resolution

-A quick sanity check of !empty($form['actions']) resolves the issue.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jnicola

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