Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function import(Row $row, array $old_destination_id_values = array())
 {
     $uid = $row->getDestinationProperty('uid');
     $module = $row->getDestinationProperty('module');
     $key = $row->getDestinationProperty('key');
     $this->userData->set($module, $uid, $key, $row->getDestinationProperty('settings'));
     return [$uid, $module, $key];
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $consumer_key = user_password(32);
     $consumer_secret = user_password(32);
     $key_hash = sha1($consumer_key);
     $uid = $form_state->getValue('uid');
     $consumer = array('consumer_secret' => $consumer_secret, 'key_hash' => $key_hash);
     $this->user_data->set('oauth', $uid, $consumer_key, $consumer);
     drupal_set_message($this->t('Added a new consumer.'));
     Cache::invalidateTags(['oauth:' . $uid]);
     $form_state->setRedirect('oauth.user_consumer', array('user' => $uid));
 }