Figure out a better way to inline action buttons

Created on 25 February 2013, over 11 years ago
Updated 29 October 2023, 8 months ago

Problem

In #663946: Merge "List links" page into "Edit menu" page β†’ it was proposed that the resulting merged form does not have the "add item" action button at the top at the standard place, but inside the page. That is a non-standard place for action buttons and required to work around the action button system and apply styling only to a strategically formatter action link. While the immediate usability of the form improved a great deal, the action link is not anymore programatically discoverable. There are certainly better ways to solve this if we introduce higher level rendering solutions for action links. The patch used this:

  // Inline the "Add link" action so it displays right above the table of
  // links. No access check needed, since this form has the same access
  // restriction as adding menu items to the menu.
  $form['inline_actions'] = array(
    '#prefix' => '<ul class="action-links">',
    '#suffix' => '</ul>',
  );
  $form['inline_actions']['add'] = array(
    '#theme' => 'menu_local_action',
    '#link' => array(
      'href' => 'admin/structure/menu/manage/' . $form_state['menu']->id() . '/add',
      'title' => t('Add link'),
    ),
  );

And then later in the theme function:

  $output .= drupal_render($form['inline_actions']);

This is because there is no element for menu local actions to be used.

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
Menu moduleΒ  β†’

Last updated about 2 months ago

Created by

πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

Live updates comments and jobs are added and updated live.
  • API clean-up

    Refactors an existing API or subsystem for consistency, performance, modularization, flexibility, third-party integration, etc. May imply an API change. Frequently used during the Code Slush phase of the release cycle.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024