user_cancel_url(UserInterface $account, $options = array())
Generates a URL to confirm an account cancellation request.
Parameters
\Drupal\user\UserInterface $account: The user account object.
array $options: (optional) A keyed array of settings. Supported options are:
- langcode: A language code to be used when generating locale-sensitive URLs. If langcode is NULL the users preferred language is used.
Return value
string A unique URL that may be used to confirm the cancellation of the user account.
See also
\Drupal\user\Controller\UserController::confirmCancel()
File
- core/modules/user/user.module, line 614
- Enables the user registration and login system.
Code
1 2 3 4 5 6 7 8 9 10 | function user_cancel_url(UserInterface $account , $options = array ()) { $timestamp = REQUEST_TIME; $langcode = isset( $options [ 'langcode' ]) ? $options [ 'langcode' ] : $account ->getPreferredLangcode(); $url_options = array ( 'absolute' => TRUE, 'language' => \Drupal::languageManager()->getLanguage( $langcode )); return \Drupal::url( 'user.cancel_confirm' , [ 'user' => $account ->id(), 'timestamp' => $timestamp , 'hashed_pass' => user_pass_rehash( $account , $timestamp ) ], $url_options ); } |
Please login to continue.