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.

Issue fork simplify-3567962

Command icon 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

dieterholvoet created an issue. See original summary.

dieterholvoet’s picture

Assigned: dieterholvoet » Unassigned
Status: Active » Needs review
dieterholvoet’s picture

By the way, I'm pretty sure this warning only started appearing after updating to Drupal 11.3.2.

ryan-l-robinson’s picture

I also just noticed this error, also on 11.3.2.

phjou’s picture

The patch worked for us. Thanks.

sirclickalot’s picture

I 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.

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Same issue here, confirming the fix.

piridium’s picture

Same 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 !

anybody’s picture

Is it possible that weight save is broken because of this bug?

Below that error I also see

Warning: Trying to access array offset on null in simplify_form_taxonomy_vocabulary_form_alter() (line 131 of modules/contrib/simplify/simplify.module).
simplify_form_taxonomy_vocabulary_form_alter() (Line: 460)

Any active maintainer to merge this and tag a new release?

dpiet’s picture

I can confirm this issue. When saving a taxonomy vocabulary (Drupal 11.3.5, Simplify 2.2.2), I get the same warnings:

Warning: Trying to access array offset on null in simplify_form_taxonomy_vocabulary_form_alter() (line 131 of modules/contrib/simplify/simplify.module).

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 the base_form_id matches 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.

dpiet’s picture

Here is a patch to fix " form alter " warning for 2.2.2 version.

anybody’s picture

I pinged @dom now and asked for a new release with this fix

astonvictor’s picture

Version: 3.0.x-dev » 2.2.2

astonvictor’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

dpiet’s picture

Thanks for the merge and the credit @astonvictor.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.