You are here

function simple_oauth_form_consumer_form_submit in Simple OAuth (OAuth2) & OpenID Connect 5.x

Same name and namespace in other branches
  1. 8.4 simple_oauth.module \simple_oauth_form_consumer_form_submit()
  2. 8.3 simple_oauth.module \simple_oauth_form_consumer_form_submit()

Extra submit handler.

Parameters

array $form: The form.

\Drupal\Core\Form\FormStateInterface $form_state: The state.

1 string reference to 'simple_oauth_form_consumer_form_submit'
simple_oauth_form_consumer_form_alter in ./simple_oauth.module
Implements hook_form_FORM_ID_alter().

File

./simple_oauth.module, line 201
Contains simple_oauth.module.

Code

function simple_oauth_form_consumer_form_submit($entity_type_id, Consumer $entity, array &$form, FormStateInterface $form_state) {
  if ($entity_type_id !== 'consumer') {
    return;
  }

  // If the secret was changed, then digest it before saving. If not, then
  // leave it alone.
  if ($new_secret = $form_state
    ->getValue('new_secret')) {
    $entity
      ->get('secret')->value = $new_secret;
  }
}