public function KeyFormBase::buildForm in Key 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
2 calls to KeyFormBase::buildForm()
- KeyAddForm::buildForm in src/
Form/ KeyAddForm.php - Form constructor.
- KeyEditForm::buildForm in src/
Form/ KeyEditForm.php - Form constructor.
2 methods override KeyFormBase::buildForm()
- KeyAddForm::buildForm in src/
Form/ KeyAddForm.php - Form constructor.
- KeyEditForm::buildForm in src/
Form/ KeyEditForm.php - Form constructor.
File
- src/
Form/ KeyFormBase.php, line 55
Class
- KeyFormBase
- Base form for key add and edit forms.
Namespace
Drupal\key\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// If the form is rebuilding.
if ($form_state
->isRebuilding()) {
// If a key type change triggered the rebuild.
if ($form_state
->getTriggeringElement()['#name'] == 'key_type') {
// Update the type and input plugins.
$this
->updateKeyType($form_state);
$this
->updateKeyInput($form_state);
}
// If a key provider change triggered the rebuild.
if ($form_state
->getTriggeringElement()['#name'] == 'key_provider') {
// Update the provider and input plugins.
$this
->updateKeyProvider($form_state);
$this
->updateKeyInput($form_state);
}
}
else {
// Update the input plugin.
$this
->updateKeyInput($form_state);
}
return parent::buildForm($form, $form_state);
}