- π§πͺBelgium kriboogh
might be related also to #3036077 ( https://www.drupal.org/project/token/issues/3036077 π Bug with menu item uuid when first save a node Needs review )
I was also looking into this as some of our clients reported to have rogue menu items with uuid's.
Looking at the condition to return if preview is being engaged, why is it only done when a new node is created? suppose an existing node without a menu item is being updated and you select a menu item and preview it? wouldn't this be the same situation? I think the menu item should only be created when an actual safe is performed.
What @berdir said also is more logical to implement, and independent on the id naming strategy of the triggered element.
> Maybe check what kind of submit #submit callbacks are defined and only do it for those that contain ::save? - First commit to issue fork.
- last update
over 1 year ago 77 pass - @kriboogh opened merge request.
- last update
over 1 year ago 77 pass - π§πͺBelgium kriboogh
I created a MR for the solution @berdir mentioned. It now checks if ::save is in the submit handlers array, and only does the create if a save is performed (new or updated).
- πΊπΈUnited States banoodle San Francisco, CA
Just want to report that this patch works for me and that I had this problem even though I'm just using Drupal core's previewing and not the responsive preview module.
In my case, the extra menu link doesn't get created every time I preview the node, but in the course of several attempts I can see it happen once. Not sure why it is sporadic, but patch 6 seems to fix it.
Thanks!
I'm not going to set this to RBTC because I think someone using Responsive Preview should also validate this.
- last update
about 1 year ago 77 pass - last update
about 1 year ago 77 pass -
Berdir β
committed e0086103 on 8.x-1.x authored by
kriboogh β
Issue #3218969 by oheller, kriboogh: Extra menu links are created on...
-
Berdir β
committed e0086103 on 8.x-1.x authored by
kriboogh β
- Status changed to Fixed
about 1 year ago 9:06am 21 October 2023 - Status changed to Needs work
about 1 year ago 3:47pm 27 October 2023 - πΊπΈUnited States clayfreeman Paragould, AR
This issue introduces a major bug that breaks AJAX for form elements without a
#submit
key:TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 675 of /code/web/modules/contrib/token/token.module)
#0 /code/web/modules/contrib/token/token.module(675): in_array('::save', NULL)
#1 [internal function]: token_node_menu_link_submit('node', Object(Drupal\node\Entity\Node), Array, Object(Drupal\Core\Form\FormState))The condition also needs to check whether the key exists, otherwise we may pass NULL to
in_array()
. - πΊπΈUnited States DamienMcKenna NH, USA
I opened π 3218969 breaks some AJAX forms Active for the bug, but will leave Berdir to re-close this one so the attribution isn't lost.
- Status changed to Fixed
about 1 year ago 8:04pm 10 November 2023 Automatically closed - issue fixed for 2 weeks with no activity.