1 filter.module filter_editor_dialog_token($format, $dialog_name, $account = NULL, $path = NULL)

Generate a URL token for checking access to an editor dialog.

Note that we do not use backdrop_get_token() because it requires an active session.

Parameters

stdClass $format: An object representing the text format.

string $dialog_name: The type of dialog that will be opened.

User $account: The user account that will be opening the dialog.

string $path: The path from which the dialog will be opened. Defaults to the current path.

Return value

string: A token intended to be used in a query string.

File

core/modules/filter/filter.module, line 914
Framework for handling the filtering of content.

Code

function filter_editor_dialog_token($format, $dialog_name, $account = NULL, $path = NULL) {
  if (!isset($account)) {
    $account = $GLOBALS['user'];
  }
  if (!isset($path)) {
    $path = $_GET['q'];
  }
  $values = array(
    $path,
    $format->format,
    $dialog_name,
    $account->uid,
  );
  return backdrop_hmac_base64(implode('-', $values), backdrop_get_private_key() . backdrop_get_hash_salt());
}