To implement the designs in #2828874: Design top level landing page for the new documentation system, we need to be able to display two levels of menu items in a menu on /documentation.

- Official Guides
-- User Guide
- Community Guides
-- Drupal 8
-- APIs
-- Developers

Suggested implementation:

  • Create a new "documentation" menu
  • Allow the new menu to be added as a panel pane to section nodes
  • Grant grasmash access to the "documentation menu"

Comments

grasmash created an issue. See original summary.

grasmash’s picture

What is the mechanism for enforcing flat OG menus? I can't find the code or configuration responsible. Is it a d.o customization?

grasmash’s picture

Issue summary: View changes
drumm’s picture

There are a few places throughout drupalorg module for this:

In drupalorg_form_node_form_alter():

  // If this is a documentation page or guide, only allow keeping one level of
  // menu hierarchy.
  if ($form['#node']->type === 'guide' || $form['#node']->type === 'documentation') {
    if (isset($form['menu'])) {
      // Only disable so og_menu JS is not confused.
      $form['menu']['link']['parent']['#element_validate'] = ['drupalorg_form_node_form_no_ancestry'];
    }

and

/**
 * Implements hook_form_FORM_ID_alter().
 */
function drupalorg_form_og_menu_edit_item_form_alter(&$form) {
  // Disable menu hierarchy.
  $form['parent']['#disabled'] = TRUE;
}

/**
 * Implements hook_js_alter().
 */
function drupalorg_js_alter(&$js) {
  // For OG menus, disable menu hierarchy.
  if (arg(0) === 'group' && arg(3) === 'admin' && arg(4) === 'menus' && !empty($js['settings']['data'])) {
    foreach ($js['settings']['data'] as &$setting) {
      if (isset($setting['tableDrag']['menu-overview']['menu-plid'])) {
        $setting = [];
      }
    }
  }
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function drupalorg_form_og_menu_overview_form_alter(&$form) {
  // drupalorg_js_alter() sometimes doesn’t prevent hierarchy UI. Hard-code it.
  foreach (element_children($form) as $key) {
    $form[$key]['plid']['#value'] = 0;
  }
}

However, if this is just for one landing page, or a handful of pages, do we really need OG menu? This can be a separate menu created at /admin/structure/menu.

grasmash’s picture

I'm fine with creating a separate menu at /admin/structure/menu. However, I do not have the permission to do that.

This will require a DA admin to:

  1. Create a new "documentation" menu
  2. Add that menu to the allowed content for panelized section nodes
  3. Grant me access to edit the new menu
grasmash’s picture

grasmash’s picture

Issue summary: View changes

Updating issue summary.

grasmash’s picture

Title: Allow two tier menus on section node OG menus » Create new documentation menu
grasmash’s picture

I guess the other option here is to hardcode the HTML in a custom pane and just apply a CSS class.

grasmash’s picture

Status: Active » Needs review

Need review from Drum.

Please indicate whether we should:

1. Create 2 new menus on Drupal.org, or
2. Hard code HTML lists in custom blocks.

If 2, the following work is required of a Drupal.org admin:

  • Create a new "Drupal 8 Documentation" menu
  • Create a new "Drupal 7 Documentation" menu
  • Allow the new menus to be added as a panel pane to section nodes
  • Grant grasmash access to edit menus"
grasmash’s picture

This issue has been in "needs review" status for 27 days. How can this be moved forward?

grasmash’s picture

As a temporary solution, these menus have been added as hardcoded HTML into panel panes on the following nodes:

https://www.drupal.org/documentation
https://www.drupal.org/node/2995339

hansfn’s picture

That is a start :-)

Can I complain about URLs again? The Drupal 7 tab on https://www.drupal.org/documentation links to https://www.drupal.org/node/2995339 - not the URL alias (which is https://www.drupal.org/documentation/7).

PS! The Drupal 7 tab on https://www.drupal.org/documentation/7 links to https://www.drupal.org/drupal-7-documentation - which doesn't exist.

grasmash’s picture

Both broken links have been fixed.

grasmash’s picture

Status: Needs review » Closed (won't fix)

I'd fine with the hardcoded menus. It doesn't seem worth the overhead to create the menus, assign permissions, and make the panes available. Closing.