You are here

public function GoogleAuthSettingsForm::buildForm in Open Social 8.9

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

Class

GoogleAuthSettingsForm
Class GoogleAuthSettingsForm.

Namespace

Drupal\social_auth_google\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('social_auth_google.settings');
  $form['settings'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Google+ App settings'),
    '#open' => TRUE,
    '#description' => $this
      ->t('You need to first create a Google App at <a href="@url">@url</a>', [
      '@url' => 'https://console.developers.google.com',
    ]),
  ];
  $form['settings']['client_id'] = [
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => $this
      ->t('Client ID'),
    '#default_value' => $config
      ->get('client_id'),
    '#description' => $this
      ->t('Copy the Client ID here'),
  ];
  $form['settings']['client_secret'] = [
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => $this
      ->t('Client Secret'),
    '#default_value' => $config
      ->get('client_secret'),
    '#description' => $this
      ->t('Copy the Client Secret here'),
  ];
  $form['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);
}