Problem/Motivation
When visiting a taxonomy vocabulary overview form, simplify settings are shown (which they shouldn't), together with the following warning:
Warning: Undefined array key "vid" in simplify_form_taxonomy_vocabulary_form_alter() (line 114 of /[..]/web/modules/contrib/simplify/simplify.module)
Since the taxonomy vocabulary base_form_id equals the form_id of the taxonomy vocabulary edit form, the simplify_form_taxonomy_vocabulary_form_alter() hook implementation is also invoked for other taxonomy vocabulary forms such as the overview.
Steps to reproduce
Visit the overview page of a specific taxonomy vocabulary.
Proposed resolution
Add an extra form_id check.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | simplify-3567962-form-alter-fix-12-2.2.2-20.patch | 861 bytes | dpiet |
Issue fork simplify-3567962
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
dieterholvoet commentedComment #4
dieterholvoet commentedBy the way, I'm pretty sure this warning only started appearing after updating to Drupal 11.3.2.
Comment #5
ryan-l-robinson commentedI also just noticed this error, also on 11.3.2.
Comment #6
phjouThe patch worked for us. Thanks.
Comment #7
sirclickalotI confirm that this reared its head after the changes to core Entity Form hooks introduced in 11.3.2.
I can also confirm that the patch from MR: https://git.drupalcode.org/project/simplify/-/merge_requests/20 fixes it nicely.
Comment #8
anybodySame issue here, confirming the fix.
Comment #9
piridium commentedSame issue on Drupal 11.3.3 with Simplify 2.2.2. Applied the patch from this issue, warnings on /admin/structure/taxonomy/manage//overview are gone. Fix confirmed.
Thank you @dieterholvoet !
Comment #10
anybodyIs it possible that weight save is broken because of this bug?
Below that error I also see
Any active maintainer to merge this and tag a new release?
Comment #11
dpiet commentedI can confirm this issue. When saving a taxonomy vocabulary (Drupal 11.3.5, Simplify 2.2.2), I get the same warnings:
The root cause is that
simplify_form_taxonomy_vocabulary_form_alter()is also invoked for other taxonomy vocabulary forms (e.g. the overview/weight form) since thebase_form_idmatches the form_id of the edit form.I tested the proposed fix — adding an early return when
$form_id !== 'taxonomy_vocabulary_form'— and it resolves the issue. Taxonomy vocabulary saves work correctly after applying the patch, with no more warnings.+1 for getting this merged and included in a new release.
Comment #12
dpiet commentedHere is a patch to fix " form alter " warning for 2.2.2 version.
Comment #13
anybodyI pinged @dom now and asked for a new release with this fix
Comment #14
astonvictor commentedComment #17
astonvictor commentedComment #19
dpiet commentedThanks for the merge and the credit @astonvictor.