Skip to content

Drop link title key from 'lis' array on tb_megamenu_nav and tb_megamenu_subnav preprocess functions.

Title as array key can trigger a variety of errors. And I haven't found any functionality from tb_megamenu module that relies on the array's key name. In the case of PHP 8.1 it could trigger an error of type TypeError: Illegal offset type in template_preprocess_tb_megamenu_subnav() (line 277 of modules/contrib/tb_megamenu/tb_megamenu.module) when, for instance, a contrib/custom menu plugin instance try to get a menu item title from core's titleResolver. See: https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/lib/Drupal/Core/Controller/TitleResolver.php#L77.

So, I propose to simply drop that key and insert a new item into the array.

Edited by João Eduardo Ramos Costa

Merge request reports