You are here

public function FacebookAuthSettingsForm::buildForm in Open Social 8

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

Class

FacebookAuthSettingsForm
Class FacebookAuthSettingsForm.

Namespace

Drupal\social_auth_facebook\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('social_auth_facebook.settings');
  $form['settings'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Facebook App settings'),
    '#open' => TRUE,
    '#description' => $this
      ->t('You need to first create a Facebook App at <a href="@url">@url</a>', [
      '@url' => 'https://developers.facebook.com/apps',
    ]),
  ];
  $form['settings']['app_id'] = [
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => $this
      ->t('Application ID'),
    '#default_value' => $config
      ->get('app_id'),
    '#description' => $this
      ->t('Copy the App ID of your Facebook App here. This value can be found from your App Dashboard.'),
  ];
  $form['settings']['app_secret'] = [
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => $this
      ->t('Application Secret'),
    '#default_value' => $config
      ->get('app_secret'),
    '#description' => $this
      ->t('Copy the App Secret of your Facebook App here. This value can be found from your App Dashboard.'),
  ];
  $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);
}