public function EncryptionProfileForm::buildForm in Encrypt 8.3
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/ EncryptionProfileForm.php, line 75
Class
- EncryptionProfileForm
- Provides the form to add / edit an EncryptionProfile entity.
Namespace
Drupal\encrypt\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// If the form is rebuilding.
if ($form_state
->isRebuilding()) {
// If an encryption method change triggered the rebuild.
if ($form_state
->getTriggeringElement()['#name'] == 'encryption_method') {
// Update the encryption method plugin.
$this
->updateEncryptionMethod($form_state);
}
}
elseif ($this->operation == "edit") {
// Only when the form is first built.
/* @var $encryption_profile \Drupal\encrypt\Entity\EncryptionProfile */
$encryption_profile = $this->entity;
$this->originalProfile = clone $encryption_profile;
}
return parent::buildForm($form, $form_state);
}