You are here

public function VideoEmbedHtml5ConfigForm::buildForm in Video Embed HTML5 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/VideoEmbedHtml5ConfigForm.php, line 58

Class

VideoEmbedHtml5ConfigForm
Class VideoEmbedHtml5ConfigForm @package Drupal\video_embed_html5\Form

Namespace

Drupal\video_embed_html5\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('video_embed_html5.config');
  $form['add_placeholder'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Add placeholder while generating video thumbnail'),
    '#description' => $this
      ->t('This only applies when the module "PHP FFMpeg" is not installed.'),
    '#default_value' => $config
      ->get('add_placeholder'),
  ];
  $form['placeholder'] = [
    '#type' => 'managed_file',
    '#title' => $this
      ->t('Placeholder image'),
    '#upload_location' => 'public://',
    '#upload_validators' => [
      'file_validate_extensions' => [
        'jpg',
        'png',
      ],
    ],
    '#default_value' => $config
      ->get('placeholder'),
  ];
  return parent::buildForm($form, $form_state);
}