public function EnvironmentForm::form in Environment 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/ EnvironmentForm.php, line 23 - Contains Drupal\environment\Form\EnvironmentForm.
Class
- EnvironmentForm
- Class EnvironmentForm.
Namespace
Drupal\environment\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$environment = $this->entity;
$form['label'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $environment
->label(),
'#description' => $this
->t("Label for the Environment."),
'#required' => TRUE,
);
$form['id'] = array(
'#type' => 'machine_name',
'#default_value' => $environment
->id(),
'#machine_name' => array(
'exists' => '\\Drupal\\environment\\Entity\\Environment::load',
),
'#disabled' => !$environment
->isNew(),
);
$form['description'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Description'),
'#maxlength' => 255,
'#default_value' => $environment
->getDescription(),
'#description' => $this
->t("Description for the Environment."),
'#required' => TRUE,
);
return $form;
}