You are here

function onlyone_menu_local_actions_alter in Allow a content type only once (Only One) 8

Implements hook_menu_local_actions_alter().

File

./onlyone.module, line 75
Contains onlyone.module.

Code

function onlyone_menu_local_actions_alter(&$local_actions) {

  // Adding the local actions if the new menu entry option is active.
  if (\Drupal::config('onlyone.settings')
    ->get('onlyone_new_menu_entry')) {
    $local_actions['onlyone.add_page'] = [
      'title' => t('Add content (Only One)'),
      'weight' => -1,
      'route_name' => 'onlyone.add_page',
      'options' => [],
      'appears_on' => [
        'system.admin_content',
      ],
      'class' => 'Drupal\\Core\\Menu\\LocalActionDefault',
    ];
  }
}