You are here

public function ClientAuthorizationPluginBase::submitConfigurationForm in Entity Share 8.3

Form submission 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::submitConfigurationForm

1 method overrides ClientAuthorizationPluginBase::submitConfigurationForm()
Oauth::submitConfigurationForm in modules/entity_share_client/src/Plugin/ClientAuthorization/Oauth.php
Form submission handler.

File

modules/entity_share_client/src/ClientAuthorization/ClientAuthorizationPluginBase.php, line 177

Class

ClientAuthorizationPluginBase
Base class for Client authorization plugins.

Namespace

Drupal\entity_share_client\ClientAuthorization

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $key = NULL;
  $values = $form_state
    ->getValues();
  $configuration = $this
    ->getConfiguration();
  $provider = $values['credential_provider'];
  $credentials = $values[$provider];
  switch ($provider) {
    case 'entity_share':
      $this->keyValueStore
        ->set($configuration['uuid'], $credentials);
      $key = $configuration['uuid'];
      break;
    case 'key':
      $this->keyValueStore
        ->delete($configuration['uuid']);
      $key = $credentials['id'];
      break;
  }
  $configuration['data'] = [
    'credential_provider' => $provider,
    'storage_key' => $key,
  ];
  $this
    ->setConfiguration($configuration);
}