public function GatsbyInstantPreviewAdminForm::buildForm in Gatsby Live Preview & Incremental Builds 8
Same name and namespace in other branches
- 2.0.x modules/gatsby_instantpreview/src/Form/GatsbyInstantPreviewAdminForm.php \Drupal\gatsby_instantpreview\Form\GatsbyInstantPreviewAdminForm::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 GatsbyAdminForm::buildForm
File
- modules/
gatsby_instantpreview/ src/ Form/ GatsbyInstantPreviewAdminForm.php, line 16
Class
- GatsbyInstantPreviewAdminForm
- Class GatsbyAdminForm.
Namespace
Drupal\gatsby_instantpreview\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$config = $this
->config('gatsby.settings');
$form['secret_key'] = [
'#type' => 'textfield',
'#title' => $this
->t('Gatsby Secret Key'),
'#description' => $this
->t('A Secret Key value that will be sent to Gatsby Preview and Build servers for an
additional layer of security. <a href="#" id="gatsby--generate">Generate a Secret Key</a>'),
'#default_value' => $config
->get('secret_key'),
'#weight' => 5,
];
$form['additional_settings'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Additional JSON:API Settings'),
'#weight' => 6,
];
$form['#attached']['library'][] = 'gatsby/gatsby_admin';
return $form;
}