public function FacebookAlbumForm::buildForm in Facebook Album 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/ FacebookAlbumForm.php, line 72 - Contains \Drupal\facebook_album\Form\FacebookAlbumForm.
Class
- FacebookAlbumForm
- Configure facebook_album settings for this site.
Namespace
Drupal\facebook_album\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Get module configuration.
$config = $this
->config('facebook_album.settings')
->get();
// @TODO: Style this, add more detail
if (!empty($config['access_token'])) {
$form['notice'] = [
'#markup' => $this
->t('You already have configured your application.'),
];
}
$form['app_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('Facebook App ID'),
'#default_value' => $config['app_id'],
'#required' => TRUE,
'#description' => $this
->t('The application ID specified in your Facebook App\'s dashboard page.'),
];
$form['app_secret'] = [
'#type' => 'password',
'#title' => $this
->t('Facebook App Secret'),
'#default_value' => $config['app_secret'],
'#required' => TRUE,
'#description' => $this
->t('The application secret specified in your Facebook App\'s dashboard page. This field remains blank for security purposes. If you have already saved your application secret, leave this field blank, unless you wish to update it.'),
];
return parent::buildForm($form, $form_state);
}