public function DataPolicyAddForm::buildForm in Data Policy 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/ DataPolicyAddForm.php, line 93
Class
- DataPolicyAddForm
- Class DataPolicyAddForm.
Namespace
Drupal\data_policy\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
if ($this->routeName === 'entity.data_policy.revision_add') {
$this->entity = $this->entityTypeManager
->getStorage('data_policy')
->load($this->entityId);
$form = parent::buildForm($form, $form_state);
$form['active_revision']['#default_value'] = TRUE;
$form['active_revision']['#disabled'] = TRUE;
$form['new_revision']['#default_value'] = FALSE;
return $form;
}
return parent::buildForm($form, $form_state);
}