You are here

protected static function BrightcoveVideoPlaylistForm::getPlayerOptions in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 src/Form/BrightcoveVideoPlaylistForm.php \Drupal\brightcove\Form\BrightcoveVideoPlaylistForm::getPlayerOptions()
  2. 3.x src/Form/BrightcoveVideoPlaylistForm.php \Drupal\brightcove\Form\BrightcoveVideoPlaylistForm::getPlayerOptions()

Get the player options for the given api client.

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 list of options for the player selection.

2 calls to BrightcoveVideoPlaylistForm::getPlayerOptions()
BrightcoveVideoPlaylistForm::apiClientUpdateForm in src/Form/BrightcoveVideoPlaylistForm.php
Ajax callback to update the player options list.
BrightcoveVideoPlaylistForm::buildForm in src/Form/BrightcoveVideoPlaylistForm.php
Form constructor.

File

src/Form/BrightcoveVideoPlaylistForm.php, line 103

Class

BrightcoveVideoPlaylistForm
Base form controller for Video and Playlist forms.

Namespace

Drupal\brightcove\Form

Code

protected static function getPlayerOptions(array $form, FormStateInterface $form_state) {
  if (empty($form_state
    ->getValue('api_client'))) {
    $api_client = $form['api_client']['widget']['#default_value'];
  }
  else {
    $api_client = $form_state
      ->getValue('api_client')[0]['target_id'];
  }
  return [
    '_none' => t("Use API Client's default player"),
  ] + BrightcovePlayer::getList($api_client, TRUE);
}