You are here

public function InstagramBlockForm::buildForm in Instagram Block 8

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/InstagramBlockForm.php, line 38
Contains \Drupal\instagram_block\Form\InstagramBlockForm.

Class

InstagramBlockForm
Configure instagram_block settings for this site.

Namespace

Drupal\instagram_block\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Get module configuration.
  $config = $this
    ->config('instagram_block.settings');
  $form['authorise'] = array(
    '#markup' => t('Instagram Block requires connecting to a specific Instagram account. You need to be able to log into that account when asked to. The <a href="!help">Authenticate with Instagram</a> page helps with the setup.', array(
      '%link' => 'https://www.drupal.org/node/2746185',
    )),
  );
  $form['user_id'] = array(
    '#type' => 'textfield',
    '#title' => t('User Id'),
    '#description' => t('Your unique Instagram user id. Eg. 460786510'),
    '#default_value' => $config
      ->get('user_id'),
  );
  $form['access_token'] = array(
    '#type' => 'textfield',
    '#title' => t('Access Token'),
    '#description' => t('Your Instagram access token. Eg. 460786509.ab103e5.a54b6834494643588d4217ee986384a8'),
    '#default_value' => $config
      ->get('access_token'),
  );
  return parent::buildForm($form, $form_state);
}