public function VarnishPurgerFormBase::buildFormMetadata in Varnish purger 8.2
Same name and namespace in other branches
- 8 src/Form/VarnishPurgerFormBase.php \Drupal\varnish_purger\Form\VarnishPurgerFormBase::buildFormMetadata()
Build the 'metadata' 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\varnish_purger\Entity\VarnishPurgerSettings $settings: Configuration entity for the purger being configured.
1 call to VarnishPurgerFormBase::buildFormMetadata()
- VarnishPurgerFormBase::buildForm in src/
Form/ VarnishPurgerFormBase.php - Form constructor.
File
- src/
Form/ VarnishPurgerFormBase.php, line 112
Class
- VarnishPurgerFormBase
- Abstract form base for Varnish based configurable purgers.
Namespace
Drupal\varnish_purger\FormCode
public function buildFormMetadata(array &$form, FormStateInterface $form_state, VarnishPurgerSettings $settings) {
$form['name'] = [
'#title' => $this
->t('Name'),
'#type' => 'textfield',
'#description' => $this
->t('A label that describes this purger.'),
'#default_value' => $settings->name,
'#required' => TRUE,
];
$types = [];
foreach ($this->purgeInvalidationFactory
->getPlugins() as $type => $definition) {
$types[$type] = (string) $definition['label'];
}
$form['invalidationtype'] = [
'#type' => 'select',
'#title' => $this
->t('Type'),
'#description' => $this
->t('What sort of item will this purger clear?'),
'#default_value' => $settings->invalidationtype,
'#options' => $types,
'#required' => FALSE,
];
}