public function ServiceResourceConfigForm::form in Services 8.4
Same name and namespace in other branches
- 9.0.x src/Form/ServiceResourceConfigForm.php \Drupal\services\Form\ServiceResourceConfigForm::form()
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- src/
Form/ ServiceResourceConfigForm.php, line 17
Class
Namespace
Drupal\services\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$entity = $this->entity;
$form['formats'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Allowed formats'),
'#description' => $this
->t('Select the allowed formats for serializing the
HTTP response.'),
'#options' => $this
->getFormatOptions(),
'#default_value' => $entity
->getFormats(),
'#required' => TRUE,
];
$form['authentication'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Allowed authentication'),
'#description' => $this
->t('Select any authentication providers that are
allowed to access the resource. <br/> <strong>NOTE:</strong> If none
are selected then only public accessible data will be displayed.'),
'#options' => $this
->getAuthOptions(),
'#default_value' => $entity
->getAuthentication(),
];
$form['no_cache'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Disable cache'),
'#description' => $this
->t('Do not cache the response of the resource.'),
'#default_value' => $entity
->getNoCache(),
];
return $form;
}