diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc index e2d6841..ee438d2 100644 --- a/core/modules/taxonomy/taxonomy.admin.inc +++ b/core/modules/taxonomy/taxonomy.admin.inc @@ -9,18 +9,6 @@ use Drupal\taxonomy\Plugin\Core\Entity\Vocabulary; /** - * Page callback: provides the vocabulary creation form. - */ -function taxonomy_vocabulary_add() { - $vocabulary = entity_create('taxonomy_vocabulary', array( - // Default the new vocabulary to the site's default language. This is the - // most likely default value until we have better flexible settings. - 'langcode' => language_default()->langcode, - )); - return entity_get_form($vocabulary); -} - -/** * Form builder for the taxonomy terms overview. * * Display a tree of all the terms in a vocabulary, with options to edit diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 980ad00..585223b 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -241,11 +241,8 @@ function taxonomy_menu() { ); $items['admin/structure/taxonomy/add'] = array( 'title' => 'Add vocabulary', - 'page callback' => 'taxonomy_vocabulary_add', - 'access callback' => 'entity_page_create_access', - 'access arguments' => array('taxonomy_vocabulary'), - 'type' => MENU_LOCAL_ACTION, - 'file' => 'taxonomy.admin.inc', + 'route_name' => 'taxonomy_vocabulary_add', + 'type' => MENU_SIBLING_LOCAL_TASK, ); $items['taxonomy/term/%taxonomy_term'] = array( @@ -1304,3 +1301,18 @@ function taxonomy_library_info() { return $libraries; } + +/** + * Implements hook_local_actions. + */ +function taxonomy_local_actions() { + return array( + array( + 'route_name' => 'taxonomy_vocabulary_add', + 'title' => t('Add vocabulary'), + 'appears_on' => array( + 'taxonomy_vocabulary_list', + ), + ), + ); +} diff --git a/core/modules/taxonomy/taxonomy.routing.yml b/core/modules/taxonomy/taxonomy.routing.yml index 8715476..99ad3e5 100644 --- a/core/modules/taxonomy/taxonomy.routing.yml +++ b/core/modules/taxonomy/taxonomy.routing.yml @@ -4,3 +4,10 @@ taxonomy_vocabulary_list: _entity_list: 'taxonomy_vocabulary' requirements: _permission: 'administer taxonomy' + +taxonomy_vocabulary_add: + pattern: '/admin/structure/taxonomy/add' + defaults: + _entity_form: 'taxonomy_vocabulary' + requirements: + _permission: 'administer taxonomy'