You are here

public function SettingsForm::buildForm in Video Embed Brightcove 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/SettingsForm.php, line 68

Class

SettingsForm
Configure Video Embed Brightcove module.

Namespace

Drupal\video_embed_brightcove\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('video_embed_brightcove.settings');
  $url = Url::fromUri('https://studio.brightcove.com/products/videocloud/admin/oauthsettings', [
    'attributes' => [
      'target' => '_blank',
    ],
  ]);
  $form['client_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Brightcove API Client ID'),
    '#default_value' => $config
      ->get('client_id'),
    '#description' => $this
      ->t('The Client ID of the Brightcove API Authentication credentials, available @link. Required for thumbnail download (used for video lazy load).', [
      '@link' => Link::fromTextAndUrl($this
        ->t('here'), $url)
        ->toString(),
    ]),
  ];
  $form['client_secret'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Brightcove API Secret Key'),
    '#default_value' => $config
      ->get('client_secret'),
    '#description' => $this
      ->t('The Secret Key associated with the Client ID above. Required for thumbnail download (used for video lazy load).'),
  ];
  $form['autoplay_player'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Autoplay player name'),
    '#default_value' => $config
      ->get('autoplay_player'),
    '#description' => $this
      ->t('The player name to be used when autoplay is enabled (instead of player name from the input URL). Autoplay option needs to be enabled inside Brightcove UI.'),
  ];
  return parent::buildForm($form, $form_state);
}