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.
Issue fork group_content_menu-3487080
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 #4
jnicola commentedOkay got a merge request for it for anyone who may want this.
https://git.drupalcode.org/project/group_content_menu/-/merge_requests/43
Didn't investigate tests for this, but could reasonably write one I'm sure.
Comment #5
heddnCan we patch 3.x first? I'll backport from there. But group 1.x is on life support at the moment.
Comment #6
jnicola commentedFolks are welcome to do so, if the problem even exists there.
We're on the life support 1.x stuff until we migrate to group 2.x
Comment #7
heddnThere's an upgrade path to 3.x now, FWIW.
Comment #8
jnicola commentedUgh, go figure I spent all spring making the switch to 2.x for one of our two big products, and now 3.x is ready!!!