You are here

function template_preprocess_content_sync_help in Content Synchronization 3.0.x

Same name and namespace in other branches
  1. 8.2 includes/content_sync.theme.inc \template_preprocess_content_sync_help()
  2. 8 includes/content_sync.theme.inc \template_preprocess_content_sync_help()

Prepares variables for contnt sync help.

Default template: content_sync_help.html.twig.

Parameters

array $variables: An associative array containing:

  • title: Help title.
  • content: Help content.

File

includes/content_sync.theme.inc, line 30
Preprocessors and helper functions to make theming easier.

Code

function template_preprocess_content_sync_help(array &$variables) {

  /** @var \Drupal\content_sync\ContentSyncHelpManagerInterface $help_manager */
  $help_manager = \Drupal::service('content_sync.help_manager');
  $help_info = $variables['info'];
  $variables += $help_info;
  $help = [];
  if (!empty($help_info['menu']) && !\Drupal::config('content_sync.settings')
    ->get('content_sync.help_menu_disabled')) {
    $help['menu'] = $help_manager
      ->buildHelpMenu();
  }
  if (is_array($help_info['content'])) {
    $help['content'] = $help_info['content'];
  }
  else {
    $help['content'] = [
      '#markup' => $help_info['content'],
    ];
  }
  $variables['help'] = $help;
}