You are here

function apps_menu_local_tasks_alter in Apps 7

Implements hook_menu_local_tasks_alter().

File

./apps.module, line 214
Module file for Apps

Code

function apps_menu_local_tasks_alter(&$data, $router_item, $root_path) {

  // Add CSRF tokens to admin action links.
  if (strpos($root_path, 'admin/apps') === 0 && !empty($data['actions']['output'])) {
    $add_token = array(
      'admin/apps/%/%/disable' => 'disable',
      'admin/apps/%/%/enable' => 'enable',
      'admin/apps/%/%/install' => 'install',
      'admin/apps/%/%/uninstall' => 'uninstall',
      'admin/apps/%/%/update' => 'update',
    );
    foreach ($data['actions']['output'] as $key => $info) {
      if (!empty($info['#link']['path']) && !empty($add_token[$info['#link']['path']])) {
        $data['actions']['output'][$key]['#link']['localized_options']['query']['token'] = drupal_get_token($add_token[$info['#link']['path']] . '-' . arg(3, $info['#link']['href']));
      }
    }
  }
}