You are here

protected function ContentSyncHelpManager::initHelp in Content Synchronization 3.0.x

Same name and namespace in other branches
  1. 8.2 src/ContentSyncHelpManager.php \Drupal\content_sync\ContentSyncHelpManager::initHelp()
  2. 8 src/ContentSyncHelpManager.php \Drupal\content_sync\ContentSyncHelpManager::initHelp()

Initialize help.

Return value

array An associative array containing help.

1 call to ContentSyncHelpManager::initHelp()
ContentSyncHelpManager::__construct in src/ContentSyncHelpManager.php
Constructs a ContentSyncHelpManager object.

File

src/ContentSyncHelpManager.php, line 478

Class

ContentSyncHelpManager
Content Sync help manager.

Namespace

Drupal\content_sync

Code

protected function initHelp() {
  $help = [];

  // Install.
  $help['install'] = [
    'routes' => [
      // @see /admin/modules
      'system.modules_list',
    ],
    'title' => $this
      ->t('Installing the Content Sync module'),
    'content' => $this
      ->t('<strong>Congratulations!</strong> You have successfully installed the Content Sync module.'),
    'message_type' => 'info',
    'message_close' => TRUE,
    'message_storage' => ContentSyncMessage::STORAGE_STATE,
    'access' => $this->currentUser
      ->hasPermission('Synchronize content'),
    'video_id' => 'install',
    'menu' => TRUE,
    'uses' => FALSE,
  ];

  // Release.
  $module_info = Yaml::decode(file_get_contents($this->moduleHandler
    ->getModule('content_sync')
    ->getPathname()));
  $version = isset($module_info['version']) && !preg_match('/^8.x-\\d.\\d+-.*-dev$/', $module_info['version']) ? $module_info['version'] : '8.x-2.x-dev';
  $installed_version = $this->state
    ->get('content_sync.version');

  // Reset storage state if the version has changed.
  if ($installed_version != $version) {
    ContentSyncMessage::resetClosed(ContentSyncMessage::STORAGE_STATE, 'content_sync.help.release');
    $this->state
      ->set('content_sync.version', $version);
  }
  $t_args = [
    '@version' => $version,
    ':href' => 'https://www.drupal.org/project/content_sync/releases/' . $version,
  ];
  $help['release'] = [
    'routes' => [
      'content.sync',
    ],
    'title' => $this
      ->t('You have successfully updated...'),
    'content' => $this
      ->t('You have successfully updated to the @version release of the Content Sync module. <a href=":href">Learn more</a>', $t_args),
    'message_type' => 'status',
    'message_close' => TRUE,
    'message_storage' => ContentSyncMessage::STORAGE_STATE,
    'access' => $this->currentUser
      ->hasPermission('Synchronize content'),
    'uses' => FALSE,
  ];

  // Introduction.
  $help['introduction'] = [
    'routes' => [
      'content.sync',
    ],
    'title' => $this
      ->t('Welcome'),
    'content' => $this
      ->t('Welcome to the Content Sync module for Drupal 8. The Content Synchronization module provides a user interface for importing and exporting content changes between installations of your website in different environments. Content is stored in YAML format. For more information, see the <a href=":url">online documentation for the content synchronization module</a>.', [
      ':url' => 'https://www.drupal.org/project/content_sync',
    ]),
    'message_type' => 'info',
    'message_close' => TRUE,
    'message_storage' => ContentSyncMessage::STORAGE_USER,
    'access' => $this->currentUser
      ->hasPermission('Synchronize content'),
    'video_id' => 'introduction',
  ];

  /****************************************************************************/

  // General.

  /****************************************************************************/

  // Content Sync.
  $help['content_sync'] = [
    'routes' => [
      'content.sync',
    ],
    'title' => $this
      ->t('Content synchronization'),
    'url' => Url::fromRoute('content.sync'),
    'content' => $this
      ->t('Compare the content uploaded to your content sync directory with the active content before completing the import.'),
    'menu' => TRUE,
  ];

  // Content Export Full.
  $help['content_export_full'] = [
    'routes' => [
      'content.export_full',
    ],
    'title' => $this
      ->t('Exporting the full content'),
    'url' => Url::fromRoute('content.export_full'),
    'content' => $this
      ->t('Create and download an archive consisting of all your site\'s content exported as <em>*.yml</em> files as a gzipped tar file.'),
    'menu' => TRUE,
  ];

  // Content Export Single.
  $help['content_export_single'] = [
    'routes' => [
      'content.export_single',
    ],
    'title' => $this
      ->t('Exporting a single content item'),
    'url' => Url::fromRoute('content.export_single'),
    'content' => $this
      ->t('Export a single content item by selecting a <em>Content type</em> and <em>Content name</em>. The content and its corresponding <em>*.yml file name</em> are then displayed on the page for you to copy.'),
    'menu' => TRUE,
  ];

  // Content Import Full.
  $help['content_import_full'] = [
    'routes' => [
      'content.import_full',
    ],
    'title' => $this
      ->t('Importing the full content'),
    'url' => Url::fromRoute('content.import_full'),
    'content' => $this
      ->t('Upload a full site content from an archive file to the content sync directory to be imported.'),
    'menu' => TRUE,
  ];

  // Content Import Single.
  $help['content_import_single'] = [
    'routes' => [
      'content.import_single',
    ],
    'title' => $this
      ->t('Importing a single content item'),
    'url' => Url::fromRoute('content.import_single'),
    'content' => $this
      ->t('Import a single content item by pasting its YAML structure into the text field.'),
    'menu' => TRUE,
  ];

  // Content Logs.
  $help['content_logs'] = [
    'routes' => [
      'content.overview',
    ],
    'title' => $this
      ->t('Content logs'),
    'url' => Url::fromRoute('content.overview'),
    'content' => $this
      ->t('Chronological list of recorded events containing errors, warnings and operational information of the content import, export and synchronization.'),
    'menu' => TRUE,
  ];

  // Content Settings.
  $help['content_settings'] = [
    'routes' => [
      'content.settings',
    ],
    'title' => $this
      ->t('Content synchronization settings'),
    'url' => Url::fromRoute('content.settings'),
    'content' => $this
      ->t('Set specific settings for the content synchronization behavior.'),
    'menu' => TRUE,
  ];
  foreach ($help as $id => &$help_info) {
    $help_info += [
      'id' => $id,
      'uses' => TRUE,
    ];
  }
  return $help;
}