You are here

public function TwitterAuthSettingsForm::buildForm in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::buildForm()
  2. 8.2 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::buildForm()
  3. 8.3 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::buildForm()
  4. 8.4 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::buildForm()
  5. 8.5 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::buildForm()
  6. 8.6 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::buildForm()
  7. 8.7 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::buildForm()
  8. 8.8 modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php \Drupal\social_auth_twitter\Form\TwitterAuthSettingsForm::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

modules/custom/social_auth_twitter/src/Form/TwitterAuthSettingsForm.php, line 30

Class

TwitterAuthSettingsForm
Settings form for Social Auth Twitter.

Namespace

Drupal\social_auth_twitter\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('social_auth_twitter.settings');
  $form['twitter_settings'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Twitter OAuth settings'),
    '#open' => TRUE,
  ];
  $form['twitter_settings']['consumer_key'] = [
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => $this
      ->t('Consumer Key'),
    '#default_value' => $config
      ->get('consumer_key'),
    '#description' => $this
      ->t('Copy the Consumer Key here'),
  ];
  $form['twitter_settings']['consumer_secret'] = [
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => $this
      ->t('Consumer Secret'),
    '#default_value' => $config
      ->get('consumer_secret'),
    '#description' => $this
      ->t('Copy the Consumer Secret here'),
  ];
  $form['twitter_settings']['status'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Active'),
    '#default_value' => $config
      ->get('status'),
    '#description' => $this
      ->t('Determines whether this social network can be used.'),
  ];
  return parent::buildForm($form, $form_state);
}