function menu_get_local_actions

Returns the rendered local actions at the current level.

Related topics

1 call to menu_get_local_actions()
template_preprocess_page in drupal/core/includes/theme.inc
Prepares variables for the page template.

File

drupal/core/includes/menu.inc, line 2251
API for the Drupal menu system.

Code

function menu_get_local_actions() {
  $links = menu_local_tasks();
  $router_item = menu_get_item();

  // @todo Consider storing the results of hook_local_actions() in a static.
  foreach (Drupal::moduleHandler()
    ->invokeAll('local_actions') as $route_info) {
    if (in_array($router_item['route_name'], $route_info['appears_on'])) {
      $route_path = _menu_router_translate_route($route_info['route_name']);
      $action_router_item = menu_get_item($route_path);
      $links['actions'][$route_path] = array(
        '#theme' => 'menu_local_action',
        '#link' => array(
          'title' => $route_info['title'],
          'href' => $route_path,
        ),
        '#access' => $action_router_item['access'],
      );
    }
  }
  return $links['actions'];
}