public function JsonapiExtrasSettingsForm::buildForm in JSON:API Extras 8
Same name and namespace in other branches
- 8.3 src/Form/JsonapiExtrasSettingsForm.php \Drupal\jsonapi_extras\Form\JsonapiExtrasSettingsForm::buildForm()
- 8.2 src/Form/JsonapiExtrasSettingsForm.php \Drupal\jsonapi_extras\Form\JsonapiExtrasSettingsForm::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
- src/
Form/ JsonapiExtrasSettingsForm.php, line 58
Class
- JsonapiExtrasSettingsForm
- Configure JSON API settings for this site.
Namespace
Drupal\jsonapi_extras\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('jsonapi_extras.settings');
$form['path_prefix'] = [
'#title' => $this
->t('Path prefix'),
'#type' => 'textfield',
'#required' => TRUE,
'#field_prefix' => '/',
'#description' => $this
->t('The path prefix for JSON API.'),
'#default_value' => $config
->get('path_prefix'),
];
$form['include_count'] = [
'#title' => $this
->t('Include count in collection queries'),
'#type' => 'checkbox',
'#description' => $this
->t('If activated, all collection responses will return a total record count for the provided query.'),
'#default_value' => $config
->get('include_count'),
];
return parent::buildForm($form, $form_state);
}