function hook_local_actions

Define route-based local actions.

Instead of using MENU_LOCAL_ACTION in hook_menu(), implement hook_local_actions().

Return value

array An associative array containing the following keys:

  • route_name: The machine name of the local action route.
  • title: The title of the local action.
  • appears_on: An array of route names for this action to be display on.

Related topics

4 functions implement hook_local_actions()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

config_test_local_actions in drupal/core/modules/config/tests/config_test/config_test.module
Implements hook_local_actions()
menu_get_local_actions in drupal/core/includes/menu.inc
Returns the rendered local actions at the current level.
menu_test_local_actions in drupal/core/modules/system/tests/modules/menu_test/menu_test.module
Implements hook_local_actions().
views_ui_local_actions in drupal/core/modules/views_ui/views_ui.module
Implements hook_local_actions().
1 invocation of hook_local_actions()
menu_get_local_actions in drupal/core/includes/menu.inc
Returns the rendered local actions at the current level.

File

drupal/core/modules/system/system.api.php, line 886
Hooks provided by Drupal core and the System module.

Code

function hook_local_actions() {
  return array(
    array(
      'route_name' => 'mymodule.route.action',
      'title' => t('Perform local action'),
      'appears_on' => array(
        'mymodule.other_route',
        'mymodule.other_other_route',
      ),
    ),
  );
}