You are here

function cms_content_sync_menu_local_actions_alter in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 2.0.x cms_content_sync.module \cms_content_sync_menu_local_actions_alter()

File

./cms_content_sync.module, line 2009
Module file for cms_content_sync.

Code

function cms_content_sync_menu_local_actions_alter(&$local_actions) {

  // Check if the site has already been registered.
  $settings = \Drupal\cms_content_sync\Controller\ContentSyncSettings::getInstance();
  if (\Drupal\cms_content_sync\Controller\Migration::alwaysUseV2() && !$settings
    ->getSiteUuid()) {

    // Pool Overview
    $local_actions['entity.cms_content_sync_pool.add_form']['options']['attributes']['class'] = [
      'is-disabled',
    ];
    $local_actions['entity.cms_content_sync_pool.assignment_form']['options']['attributes']['class'] = [
      'is-disabled',
    ];
    $local_actions['entity.cms_content_sync_pool.add_form']['route_name'] = 'entity.cms_content_sync_pool.collection';
    $local_actions['entity.cms_content_sync_pool.assignment_form']['route_name'] = 'entity.cms_content_sync_pool.collection';

    // Flow Overview
    $local_actions['entity.cms_content_sync_flow.add_form']['options']['attributes']['class'] = [
      'is-disabled',
    ];
    $local_actions['entity.cms_content_sync_flow.add_form_advanced']['options']['attributes']['class'] = [
      'is-disabled',
    ];
    $local_actions['entity.cms_content_sync_flow.copy_remote']['options']['attributes']['class'] = [
      'is-disabled',
    ];
    $local_actions['entity.cms_content_sync_flow.add_form']['route_name'] = 'entity.cms_content_sync_flow.collection';
    $local_actions['entity.cms_content_sync_flow.add_form_advanced']['route_name'] = 'entity.cms_content_sync_flow.collection';
    $local_actions['entity.cms_content_sync_flow.copy_remote']['route_name'] = 'entity.cms_content_sync_flow.collection';
  }
}