I'm submitting this as a support request because I'm not quite sure if it already exists. Also against Drupal 7 because I don't know enough about Drupal 8 to know if it applies. So, does this exist, and if not can it? I'm currently achieving this with custom code.

<?php
/**
 * Implements hook_menu_local_tasks_alter().
 */
function MYMODULE_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  // Add action links to create nodes from their main views pages.
  $item = array('access' => FALSE);
  switch ($root_path) {
    case 'events':
    case 'events/%':
      $item = menu_get_item('node/add/event');
      $item['title'] = t('Add new Event');
      break;
    case 'resources':
      $item = menu_get_item('node/add/resource');
      $item['title'] = t('Add new Resource');
      break;
    case 'showcase':
      $item = menu_get_item('node/add/article');
      $item['title'] = t('Add new Showcase article');
      break;
  }
  if ($item['access']) {
    $data['actions']['output'][] = array(
      '#theme' => 'menu_local_action',
      '#link' => $item,
    );
  }
}

So we'd need an interface to choose the path for menu_get_item() and the field to override $item['title'].

Does this seem reasonable?

Comments

mustanggb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)