You are here

public function EncryptionKeyType::validateConfigurationForm in Key 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PluginFormInterface::validateConfigurationForm

File

src/Plugin/KeyType/EncryptionKeyType.php, line 82

Class

EncryptionKeyType
Defines a generic key type for encryption.

Namespace

Drupal\key\Plugin\KeyType

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {

  // If 'Other' was selected for the key size, use the custom entered value.
  $key_size = $form_state
    ->getValue('key_size');
  if ($key_size == 'other') {
    $form_state
      ->setValue('key_size', $form_state
      ->getValue('key_size_other_value'));
  }
  $form_state
    ->unsetValue('key_size_other_value');
}