public function CheckFormBase::form in Production check & Production monitor 8
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/ CheckFormBase.php, line 60
Class
- CheckFormBase
- Provides a base form for prod check forms.
Namespace
Drupal\prod_check\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#default_value' => $this->entity
->label(),
'#maxlength' => '255',
'#description' => $this
->t('A unique label for this advanced check. This label will be displayed in the interface of modules that integrate with prod checks.'),
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $this->entity
->id(),
'#disabled' => !$this->entity
->isNew(),
'#maxlength' => 64,
'#description' => $this
->t('A unique name for this check. It must only contain lowercase letters, numbers and underscores.'),
'#machine_name' => [
'exists' => [
$this,
'exists',
],
],
];
$form['plugin'] = [
'#type' => 'value',
'#value' => $this->entity
->get('plugin'),
];
if ($this->plugin instanceof PluginFormInterface) {
$form += $this->plugin
->buildConfigurationForm($form, $form_state);
}
return parent::form($form, $form_state);
}