Needs review
Project:
Menu target
Version:
7.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Aug 2015 at 10:11 UTC
Updated:
9 Apr 2018 at 03:05 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
a.milkovskyComment #3
fagothis has a different logic than before. previously it was used if !$node_form
Comment #4
a.milkovskythanks, you are absolutely right.
Comment #5
fagomissing space after if
Comment #6
a.milkovsky:-)
Comment #7
fagoand finally...!
Comment #8
stevendeleus commentedI think there's a better solution. Now the checkbox 'Open in a new window' appears on a node form even if no menus are selected. This is because $enabled_menus is never empty:
This is also causing the aforementioned notice. Instead I propose the following:
Comment #9
oostieDoes anyone still get this error?
The variable menu_options_NODE_TYPE is always created by Drupal core even when no menu is checked in the content type settings.
To prevent this error it's even better to change
variable_get('menu_options_' . $type, array('main-menu' => 'main-menu'));to
variable_get('menu_options_' . $type, FALSE);In that case $enabled_menus is empty when the variable does not exist.
Comment #10
oostieComment #11
stevendeleus commentedIn that case the issue will persist if the variable exists, but none of the menus are selected for the node type. The variable will return
if you deselect the default option. In other words, the check should be on non-zero values.
Comment #12
stevendeleus commentedI have another solution: replace
if (empty($enabled_menus)) {with
if (empty($enabled_menus) || count(array_filter($enabled_menus)) == 0) {Comment #13
richgerdesThe last patch (6) for this, no longer applies to do update in #2320615. The proposed solution better handles the return case, by checking for only non zero values. The attached patch should resolve this based on the thread. I additionally updated
to
to use the default value NULL not FALSE since this provides the same result from
empty().Comment #15
daniel korte#13 results in a PHP error:
Fatal error: Can't use function return value in write context in menu_target/menu_target.admin.inc on line 19
This is because the result of
array_filter()is sent directly toempty().Comment #16
richgerdesThe patch looks good, marking as RTBC.
Comment #18
oostieCommitted and created a new version, thnx!
Comment #19
oostieComment #20
catapipperI believe the wrong patch was committed resulting in version 1.7 having a fatal error on install.
Looks like #13 was committed not #15 which does work.
Comment #21
ramzypro commentedCan confirm - most recent version causes fatal error when visiting update.php after installing, had to roll back to previous version.
Comment #22
garrettw commented@Oostie Can this be fixed with #15 and released?