You are here

public function JplayerSettingsForm::buildForm in jPlayer 8.2

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/JplayerSettingsForm.php, line 50

Class

JplayerSettingsForm
Class JplayerSettingsForm.

Namespace

Drupal\jplayer\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = [];
  $form['timeformat'] = [
    '#type' => 'fieldset',
    '#title' => t('Time Format'),
    '#weight' => 1,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  ];
  $form['timeformat']['jplayer_showHour'] = [
    '#title' => t('Display hours'),
    '#type' => 'select',
    '#options' => [
      FALSE => t('No'),
      TRUE => t('Yes'),
    ],
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_showHour'),
  ];
  $form['timeformat']['jplayer_showMin'] = [
    '#title' => t('Display minutes'),
    '#type' => 'select',
    '#options' => [
      FALSE => t('No'),
      TRUE => t('Yes'),
    ],
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_showMin'),
  ];
  $form['timeformat']['jplayer_showSec'] = [
    '#title' => t('Display seconds'),
    '#type' => 'select',
    '#options' => [
      FALSE => t('No'),
      TRUE => t('Yes'),
    ],
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_showSec'),
  ];
  $form['timeformat']['jplayer_padHour'] = [
    '#title' => t('Zero-pad the hours'),
    '#type' => 'select',
    '#options' => [
      FALSE => t('No'),
      TRUE => t('Yes'),
    ],
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_padHour'),
  ];
  $form['timeformat']['jplayer_padMin'] = [
    '#title' => t('Zero-pad the minutes'),
    '#type' => 'select',
    '#options' => [
      FALSE => t('No'),
      TRUE => t('Yes'),
    ],
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_padMin'),
  ];
  $form['timeformat']['jplayer_padSec'] = [
    '#title' => t('Zero-pad the seconds'),
    '#type' => 'select',
    '#options' => [
      FALSE => t('No'),
      TRUE => t('Yes'),
    ],
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_padSec'),
  ];
  $form['timeformat']['jplayer_sepHour'] = [
    '#title' => t('Hours seperator'),
    '#type' => 'textfield',
    '#maxlength' => 32,
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_sepHour'),
  ];
  $form['timeformat']['jplayer_sepMin'] = [
    '#title' => t('Minutes seperator'),
    '#type' => 'textfield',
    '#maxlength' => 32,
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_sepMin'),
  ];
  $form['timeformat']['jplayer_sepSec'] = [
    '#title' => t('Seconds seperator'),
    '#type' => 'textfield',
    '#maxlength' => 32,
    '#default_value' => \Drupal::config('jplayer.settings')
      ->get('jplayer_sepSec'),
  ];
  return parent::buildForm($form, $form_state);
}