You are here

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

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

Build about video player or linked button.

Parameters

string $youtube_id: A YouTube id.

Return value

array A video player, linked button, or an empty array if videos are disabled.

File

src/ContentSyncHelpManager.php, line 444

Class

ContentSyncHelpManager
Content Sync help manager.

Namespace

Drupal\content_sync

Code

protected function buildAboutVideo($youtube_id) {
  $video_display = \Drupal::config('content_sync.settings')
    ->get('ui.video_display');
  switch ($video_display) {
    case 'dialog':
      return [
        '#theme' => 'content_sync_help_video_youtube',
        '#youtube_id' => $youtube_id,
        '#autoplay' => FALSE,
      ];
      break;
    case 'link':
      return [
        '#type' => 'link',
        '#title' => t('Watch video'),
        '#url' => Url::fromUri('https://youtu.be/' . $youtube_id),
        '#attributes' => [
          'class' => [
            'button',
            'button-action',
            'button--small',
            'button-content_sync-play',
          ],
        ],
        '#prefix' => ' ',
      ];
      break;
    case 'hidden':
    default:
      return [];
      break;
  }
}