You are here

public static function videojs_utility::getDisplaySettingsForm in Video.js (HTML5 Video Player) 7.3

2 calls to videojs_utility::getDisplaySettingsForm()
videojs_field_formatter_settings_form in ./videojs.module
Implements hook_field_formatter_settings_form().
videojs_settings_form in includes/videojs.admin.inc
Menu callback; Provides the Video.js settings form.

File

includes/videojs.utility.inc, line 17
This file will be used to keep all utility functions.

Class

videojs_utility
Helper functions for the Video.js module.

Code

public static function getDisplaySettingsForm(array &$element, array $values = NULL) {
  if ($values === NULL) {
    $values = self::getDefaultDisplaySettings();
  }
  $element['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Player width'),
    '#default_value' => !empty($values['width']) ? intval($values['width']) : '',
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
    '#maxlength' => 10,
    '#size' => 10,
  );
  $element['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Player height'),
    '#default_value' => !empty($values['height']) ? intval($values['height']) : '',
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
    '#maxlength' => 10,
    '#size' => 10,
  );
  $element['centeredplaybutton'] = array(
    '#type' => 'checkbox',
    '#title' => t('Center the big play button'),
    '#description' => t('By default the big play button appears in the top left of the video window.'),
    '#default_value' => !empty($values['centeredplaybutton']),
  );
  $element['autoplay'] = array(
    '#type' => 'checkbox',
    '#title' => t('Auto-play files on page load'),
    '#description' => t('Use caution when combining this option with multiple players on the same page.'),
    '#default_value' => !empty($values['autoplay']),
  );
  $element['loop'] = array(
    '#type' => 'checkbox',
    '#title' => t('Loop playback'),
    '#default_value' => !empty($values['loop']),
  );
  $element['hidecontrols'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide controls'),
    '#default_value' => !empty($values['hidecontrols']),
  );
  $element['defaulttrack'] = array(
    '#type' => 'select',
    '#title' => t('Default subtitle track'),
    '#options' => array(
      'first' => t('First track'),
      'user' => t('Current user language'),
    ),
    '#empty_value' => '',
    '#empty_option' => t('No default track'),
    '#default_value' => !empty($values['defaulttrack']) ? $values['defaulttrack'] : NULL,
    '#description' => t('When you are using VTT subtitle tracks, select which one should be activated by default.'),
  );
  foreach (language_list() as $language) {
    $languagename = empty($language->native) ? $language->name : $language->native;
    $element['defaulttrack']['#options'][$language->language] = $languagename;
  }
  $element['preload'] = array(
    '#type' => 'select',
    '#title' => t('Preload behavior'),
    '#options' => array(
      'auto' => t('Automatic preloading'),
      'metadata' => t('Only metadata'),
      'none' => t('No preloading'),
    ),
    '#default_value' => !empty($values['preload']) ? $values['preload'] : 'auto',
  );
}