public function EventForm::buildForm in Event 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides EntityForm::buildForm
File
- src/
Form/ EventForm.php, line 18
Class
- EventForm
- Form controller for Event edit forms.
Namespace
Drupal\event\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
/* @var $entity \Drupal\event\Entity\Event */
$form = parent::buildForm($form, $form_state);
$entity = $this->entity;
if (!$entity
->isNew()) {
$form['new_revision'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Create new revision'),
'#default_value' => FALSE,
'#weight' => 23,
];
}
$form['status'] = [
'#type' => 'checkbox',
'#title' => $entity
->isPublished() ? $this
->t('Published') : $this
->t('Not published'),
'#default_value' => $entity
->isPublished() ? TRUE : FALSE,
'#weight' => 25,
];
return $form;
}