You are here

protected function ApiSettingsForm::moduleActivationFbAppSettings in Facebook Instant Articles 8.2

Same name and namespace in other branches
  1. 3.x src/Form/ApiSettingsForm.php \Drupal\fb_instant_articles\Form\ApiSettingsForm::moduleActivationFbAppSettings()

Generates state of FB account connection for Module Activation section.

Parameters

array $form: FAPI array.

string $app_id: Facebook application id.

string $app_secret: Facebook application secret.

Return value

array FAPI array.

1 call to ApiSettingsForm::moduleActivationFbAppSettings()
ApiSettingsForm::moduleActivationBuildForm in src/Form/ApiSettingsForm.php
Generate the module activation section of the settings form.

File

src/Form/ApiSettingsForm.php, line 144

Class

ApiSettingsForm
Facebook Instant Articles API form.

Namespace

Drupal\fb_instant_articles\Form

Code

protected function moduleActivationFbAppSettings(array $form, $app_id, $app_secret) {
  $form['module_activation'] = [
    '#type' => 'details',
    '#title' => t('Module activation'),
    '#description' => $this
      ->t('You need a Facebook App to publish Instant Articles using this module. If you already have one, input the App ID and App Secret below, which you can find by clicking on your app <a href="https://developers.facebook.com/apps">here</a>. If you don\'t, <a href="https://developers.facebook.com/apps">create one here </a> before continuing.'),
    '#open' => TRUE,
  ];
  $form['module_activation']['app_id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('App ID'),
    '#default_value' => $app_id,
    '#size' => 30,
    '#element_validate' => [
      [
        $this,
        'validateFbAppId',
      ],
    ],
  ];
  $form['module_activation']['app_secret'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('App Secret'),
    '#default_value' => $app_secret,
    '#size' => 30,
  ];
  $form['module_activation']['next'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Next'),
    '#submit' => [
      [
        $this,
        'fbAppDetailsSubmit',
      ],
    ],
  ];
  return $form;
}