You are here

public function DataPolicyRevisionEdit::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 DataPolicyForm::buildForm

File

src/Form/DataPolicyRevisionEdit.php, line 105

Class

DataPolicyRevisionEdit
Provides a form for editing a Data policy revision.

Namespace

Drupal\data_policy\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $this->entity = $this->entityTypeManager
    ->getStorage('data_policy')
    ->loadRevision($this->revisionId);
  $form = parent::buildForm($form, $form_state);
  $form['active_revision']['#default_value'] = $this->entity
    ->isDefaultRevision();
  $form['active_revision']['#disabled'] = $this->entity
    ->isDefaultRevision();
  $form['new_revision']['#default_value'] = FALSE;
  return $form;
}