You are here

public function VimeoSettingsForm::buildForm in Vimeo Video Uploader 8

Same name and namespace in other branches
  1. 8.4 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 46
Contains \Drupal\vimeo_video_uploader\Form\SettingsForm.

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'] = array(
    '#type' => 'fieldset',
    '#title' => $this
      ->t('VIMEO VIDEO UPLOAD CONFIGURATION'),
    '#collapsible' => TRUE,
    '#tree' => TRUE,
  );
  $form['values']['client_id'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Enter (Vimeo Client Identifier) '),
    '#default_value' => $config
      ->get('values.client_id'),
    '#required' => TRUE,
  );
  $form['values']['client_secret'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Enter (Vimeo Client Secrets)'),
    '#default_value' => $config
      ->get('values.client_secret'),
    '#required' => TRUE,
  );
  $form['values']['access_token'] = array(
    '#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'] = array(
    '#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);
}