You are here

function _brightcove_admin_apply_on_configuration in Brightcove Video Connect 7.6

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

Applies a configuration form state to a Configuration object.

Parameters

array $form_state:

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

2 calls to _brightcove_admin_apply_on_configuration()
brightcove_admin_embed_edit_form_submit in ./brightcove.player.inc
Submit handler for brightcove_admin_embed_edit_form().
brightcove_admin_player_edit_form_submit in ./brightcove.player.inc
Submit handler for brightcove_admin_player_edit_form().

File

./brightcove.player.inc, line 900

Code

function _brightcove_admin_apply_on_configuration(array &$form_state, \Brightcove\Object\Player\Branch\Configuration\Configuration $configuration) {
  $v =& $form_state['values'];
  if (isset($v['embed_name'])) {
    $configuration
      ->setEmbedName($v['embed_name']);
  }
  $configuration
    ->setAutoadvance(is_numeric($v['autoadvance']) ? $v['autoadvance'] : NULL);
  $configuration
    ->setAutoplay((bool) $v['autoplay']);
  if (!$configuration
    ->getCss()) {
    $configuration
      ->setCss(new \Brightcove\Object\Player\Branch\Configuration\CSS());
  }
  else {
    $configuration
      ->fieldChanged('css');
  }
  $configuration
    ->getCss()
    ->setControlBarColor($v['controlBarColor']);
  $configuration
    ->getCss()
    ->setControlColor($v['controlColor']);
  $configuration
    ->getCss()
    ->setProgressColor($v['progressColor']);
  $configuration
    ->setFullscreenControl((bool) $v['fullscreenControl']);
  $configuration
    ->setLanguages(array_map('trim', explode(',', $v['languages'])));
  $configuration
    ->setLoop((bool) $v['loop']);
  if (!$configuration
    ->getPlayer()) {
    $configuration
      ->setPlayer(new \Brightcove\Object\Player\Branch\Configuration\Player());
  }
  else {
    $configuration
      ->fieldChanged('player');
  }
  $configuration
    ->getPlayer()
    ->setInactive((bool) $v['inactive']);
  $configuration
    ->setPlaylist((bool) $v['playlist']);
  $configuration
    ->setPlayOnSelect((bool) $v['playOnSelect']);
  $configuration
    ->setPreload($v['preload']);
  $configuration
    ->setScripts(explode(PHP_EOL, $v['scripts']));
  $configuration
    ->setStylesheets(explode(PHP_EOL, $v['stylesheets']));
  $skin = $v['skin'];
  if (is_numeric($skin)) {
    $skin = (bool) $skin;
  }
  $configuration
    ->setSkin($skin);
  if (!$configuration
    ->getStudioConfiguration()) {
    $configuration
      ->setStudioConfiguration(new \Brightcove\Object\Player\Branch\Configuration\StudioConfiguration());
  }
  if (!$configuration
    ->getStudioConfiguration()
    ->getPlayer()) {
    $configuration
      ->getStudioConfiguration()
      ->setPlayer(new \Brightcove\Object\Player\Branch\Configuration\StudioConfigurationPlayer());
  }
  $configuration
    ->getStudioConfiguration()
    ->getPlayer()
    ->setAdjusted((bool) $v['adjusted']);
  $configuration
    ->getStudioConfiguration()
    ->getPlayer()
    ->setHeight($v['height']);
  $configuration
    ->getStudioConfiguration()
    ->getPlayer()
    ->setWidth($v['width']);
}