You are here

function _brightcove_admin_player_configuration_form in Brightcove Video Connect 7.6

Same name and namespace in other branches
  1. 7.7 brightcove.player.inc \_brightcove_admin_player_configuration_form()

Creates the form elements for a Configuration object.

Parameters

array $form:

\Brightcove\Object\Player\Branch\Configuration\Configuration $configuration:

Return value

array

2 calls to _brightcove_admin_player_configuration_form()
brightcove_admin_embed_edit_form in ./brightcove.player.inc
Form callback for 'admin/config/media/brightcove/players/%/%/{%/edit,add-embed}'.
brightcove_admin_player_edit_form in ./brightcove.player.inc
Form callback for 'admin/config/media/brightcove/players/{%/%/edit,add}'.

File

./brightcove.player.inc, line 719

Code

function _brightcove_admin_player_configuration_form(array $form, \Brightcove\Object\Player\Branch\Configuration\Configuration $configuration) {
  $form['autoadvance'] = [
    '#type' => 'textfield',
    '#title' => t('Autoadvance'),
    '#default_value' => $configuration
      ->isAutoadvance(),
    '#description' => t('autoadvance setting if using playlists: 0 for no wait; a number for seconds between advance; empty to cancel autoadvance'),
  ];
  $form['autoplay'] = [
    '#type' => 'checkbox',
    '#title' => t('Autoplay'),
    '#default_value' => $configuration
      ->isAutoplay(),
    '#description' => t('indicates player should play video immediately, on platforms that allow this'),
  ];
  $form['css'] = [
    '#type' => 'fieldset',
    '#title' => t('CSS'),
    '#collapsible' => FALSE,
  ];
  $form['css']['controlBarColor'] = [
    '#type' => 'textfield',
    '#title' => t('Control bar color'),
    '#default_value' => $configuration
      ->getCss() ? $configuration
      ->getCss()
      ->getControlBarColor() : NULL,
    '#description' => t('background color of control bar'),
  ];
  $form['css']['controlColor'] = [
    '#type' => 'textfield',
    '#title' => t('Control color'),
    '#default_value' => $configuration
      ->getCss() ? $configuration
      ->getCss()
      ->getControlColor() : NULL,
    '#description' => t('color of buttons and text in control bar'),
  ];
  $form['css']['progressColor'] = [
    '#type' => 'textfield',
    '#title' => t('Progress bar color'),
    '#default_value' => $configuration
      ->getCss() ? $configuration
      ->getCss()
      ->getProgressColor() : NULL,
    '#description' => t('color of progress bar'),
  ];
  $form['fullscreenControl'] = [
    '#type' => 'checkbox',
    '#title' => t('Fullscreen control'),
    '#default_value' => $configuration
      ->isFullscreenControl(),
    '#description' => t('indicates whether the fullscreen control should be shown in the control bar'),
  ];
  $form['languages'] = [
    '#type' => 'textfield',
    '#title' => t('Languages'),
    '#default_value' => implode(', ', $configuration
      ->getLanguages() ?: []),
    '#description' => t('languages (2 letter abbreviations) you wish your player to support, separated by a comma'),
  ];
  $form['loop'] = [
    '#type' => 'checkbox',
    '#title' => t('Loop'),
    '#default_value' => $configuration
      ->isLoop(),
    '#description' => t('indicates if the video should play over as soon as it ends'),
  ];
  $form['player'] = [
    '#type' => 'fieldset',
    '#title' => t('Player'),
    '#collapsible' => FALSE,
  ];
  $form['player']['inactive'] = [
    '#type' => 'checkbox',
    '#title' => t('Inactive'),
    '#default_value' => $configuration
      ->getPlayer() ? $configuration
      ->getPlayer()
      ->isInactive() : FALSE,
    '#description' => t('indicates if a player is inactive'),
  ];
  $form['playlist'] = [
    '#type' => 'checkbox',
    '#title' => t('Playlist'),
    '#default_value' => $configuration
      ->isPlaylist(),
    '#description' => t('indicates if a playlist should be used'),
  ];
  $form['playOnSelect'] = [
    '#type' => 'checkbox',
    '#title' => t('Play on select'),
    '#default_value' => $configuration
      ->isPlayOnSelect(),
    '#description' => t('indicates if a video loaded from a playlist should play on load'),
  ];
  $form['preload'] = [
    '#type' => 'radios',
    '#title' => t('Preload'),
    '#options' => [
      'auto' => t('Auto'),
      'metadata' => t('Metadata'),
      'none' => t('None'),
    ],
    '#default_value' => $configuration
      ->getPreload() ?: 'auto',
    '#description' => t('informs the browser whether or not the video data should begin downloading as soon as the video tag is loaded'),
  ];
  $form['resources'] = [
    '#type' => 'fieldset',
    '#title' => t('Resources'),
    '#collapible' => FALSE,
  ];
  $form['resources']['scripts'] = [
    '#type' => 'textarea',
    '#title' => t('Scripts'),
    '#default_value' => implode(PHP_EOL, $configuration
      ->getScripts() ?: []),
    '#description' => t('URLs to JavaScript files that should be included with the player; each URL in a new line'),
  ];
  $form['resources']['stylesheets'] = [
    '#type' => 'textarea',
    '#title' => t('Stylesheets'),
    '#default_value' => implode(PHP_EOL, $configuration
      ->getStylesheets() ?: []),
    '#description' => t('URLs to CSS files that should be included with the player; each URL in a new line'),
  ];
  $skin = $configuration
    ->getSkin();
  if ($skin === NULL) {
    $skin = TRUE;
  }
  if (is_bool($skin)) {
    $skin = $skin ? '1' : '0';
  }
  $form['skin'] = [
    '#type' => 'radios',
    '#title' => t('Skin'),
    '#options' => [
      '1' => t('Default skin'),
      '0' => t('Custom skin'),
      'graphite' => t('Legacy skin'),
    ],
    '#default_value' => $skin,
    '#description' => t('indicates is the default look-and-feel will be used with the player'),
  ];
  $form['studio_configuration'] = [
    '#type' => 'fieldset',
    '#title' => t('Playlist information normally set in Studio'),
    '#collapsible' => FALSE,
  ];
  $form['studio_configuration']['adjusted'] = [
    '#type' => 'checkbox',
    '#title' => t('Adjusted'),
    '#default_value' => $configuration
      ->getStudioConfiguration() && $configuration
      ->getStudioConfiguration()
      ->getPlayer() ? $configuration
      ->getStudioConfiguration()
      ->getPlayer()
      ->isAdjusted() : NULL,
    '#description' => t('indicates if player dimensions should be adjusted for playlist'),
  ];
  $form['studio_configuration']['height'] = [
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => $configuration
      ->getStudioConfiguration() && $configuration
      ->getStudioConfiguration()
      ->getPlayer() ? $configuration
      ->getStudioConfiguration()
      ->getPlayer()
      ->getHeight() : NULL,
    '#description' => t('player height when displayed with playlist; if the height and width are not assigned values, the sizes of the player and playlist are automatically adjusted'),
  ];
  $form['studio_configuration']['width'] = [
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => $configuration
      ->getStudioConfiguration() && $configuration
      ->getStudioConfiguration()
      ->getPlayer() ? $configuration
      ->getStudioConfiguration()
      ->getPlayer()
      ->getWidth() : NULL,
    '#description' => t('player width when displayed with playlist; if the height and width are not assigned values, the sizes of the player and playlist are automatically adjusted'),
  ];
  return $form;
}