You are here

public function VimeoSettingsForm::buildForm in Vimeo Video Uploader 8.4

Same name and namespace in other branches
  1. 8 src/Form/VimeoSettingsForm.php \Drupal\vimeo_video_uploader\Form\VimeoSettingsForm::buildForm()

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/VimeoSettingsForm.php, line 73

Class

VimeoSettingsForm
Provide configuration form for user to provide vimeo API information for a.

Namespace

Drupal\vimeo_video_uploader\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Get the configuration from ConfigFormBase::config().
  $config = self::config('vimeo_video_uploader.settings');
  $form['values'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('VIMEO VIDEO UPLOAD CONFIGURATION'),
    '#collapsible' => TRUE,
    '#tree' => TRUE,
  ];
  $form['values']['client_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Enter (Vimeo Client Identifier)'),
    '#default_value' => $config
      ->get('values.client_id'),
    '#required' => TRUE,
  ];
  $form['values']['client_secret'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Enter (Vimeo Client Secrets)'),
    '#default_value' => $config
      ->get('values.client_secret'),
    '#required' => TRUE,
  ];
  $form['values']['access_token'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Enter generated (Your new Access token)'),
    '#default_value' => $config
      ->get('values.access_token'),
    '#required' => TRUE,
  ];
  $form['values']['content_type_select'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Select the Content Types from which you have to upload video to Vimeo'),
    '#options' => $this
      ->getContentTypeList(),
    '#default_value' => $config
      ->get('values.content_type_select'),
    '#required' => TRUE,
  ];
  return parent::buildForm($form, $form_state);
}