Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aspilicious’s picture

Status: Active » Needs review
aspilicious’s picture

Status: Needs review » Needs work

Needs update functions, working on that.

aspilicious’s picture

Status: Needs work » Needs review
FileSize
4.14 KB

Done

pfrenssen’s picture

Status: Needs review » Needs work

You can save 3 lines here:

@@ -1254,7 +1254,10 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail =
           }
           $parents = $active_trail;
 
-          $expanded = variable_get('menu_expanded', array());
+          $expanded = state()->get('menu_expanded');
+          if (!$expanded) {
+            $expanded = array();
+          }
           // Check whether the current menu has any links set to be expanded.
           if (!$only_active_trail && in_array($menu_name, $expanded)) {

By doing this:

- if (!$only_active_trail && in_array($menu_name, $expanded)) {
+ if (!$only_active_trail && $expanded && in_array($menu_name, $expanded)) {

This hunk has a fatal error: too many parentheses:

+    $active = $config->get('active_menus_default');
+    if (empty($active)) {
+      $active = array_keys(menu_list_system_menus()));
+    }

And because D8 depends on PHP 5.3, you can shorten the above code to this:

+    $active = $config->get('active_menus_default') ?: array_keys(menu_list_system_menus());

Same for this:

+      $active_menus = $config->get('active_menus_default');
+      if (empty($active_menus)) {
+        $active_menus = array_keys(menu_get_menus());
+      }
aspilicious’s picture

Status: Needs work » Needs review
FileSize
4.11 KB

Another try.

pfrenssen’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks.

Status: Fixed » Closed (fixed)

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

ianthomas_uk’s picture

This didn't catch all menu_* variables. I have filled #2102521: Finish converting menu.module to CMI for the remainder.