Returns the rendered local actions at the current level.
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'];
}