public function HttpPurgerFormBase::buildFormBody in Generic HTTP Purger 8
Build the 'body' section of the form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
\Drupal\purge_purger_http\Entity\HttpPurgerSettings $settings: Configuration entity for the purger being configured.
1 call to HttpPurgerFormBase::buildFormBody()
- HttpPurgerFormBase::buildForm in src/
Form/ HttpPurgerFormBase.php - Form constructor.
File
- src/
Form/ HttpPurgerFormBase.php, line 296
Class
- HttpPurgerFormBase
- Abstract form base for HTTP based configurable purgers.
Namespace
Drupal\purge_purger_http\FormCode
public function buildFormBody(array &$form, FormStateInterface $form_state, HttpPurgerSettings $settings) {
$form['bodytab'] = [
'#type' => 'details',
'#group' => 'tabs',
'#title' => $this
->t('Body'),
'#description' => $this
->t('You can send a HTTP body, when left unchecked, nothing will be sent.'),
];
$form['bodytab']['show_body_form'] = [
'#title' => $this
->t('Send body payload'),
'#type' => 'checkbox',
'#default_value' => !($settings->body === ''),
];
$form['bodytab']['body_form_wrapper'] = [
'#type' => 'fieldgroup',
'#states' => [
'visible' => [
':input[name="show_body_form"]' => [
'checked' => TRUE,
],
],
],
];
$form['bodytab']['body_form_wrapper']['body_content_type'] = [
'#title' => $this
->t('Content-Type'),
'#type' => 'textfield',
'#default_value' => $settings->body_content_type,
];
$form['bodytab']['body_form_wrapper']['body'] = [
'#title' => $this
->t('Body payload'),
'#type' => 'textarea',
'#default_value' => $settings->body,
];
}