You are here

function piwik_user_profile_form_submit in Piwik Web Analytics 8

Submit callback for user profile form to save the Piwik setting.

1 string reference to 'piwik_user_profile_form_submit'
piwik_form_user_form_alter in ./piwik.module
Implements hook_form_FORM_ID_alter().

File

./piwik.module, line 427
Drupal Module: Piwik.

Code

function piwik_user_profile_form_submit($form, FormStateInterface $form_state) {
  $account = $form_state
    ->getFormObject()
    ->getEntity();
  if ($account
    ->id() && $form_state
    ->hasValue('user_account_users')) {
    \Drupal::service('user.data')
      ->set('piwik', $account
      ->id(), 'user_account_users', (int) $form_state
      ->getValue('user_account_users'));
  }
}