You are here

function shs_json_valid_token in Simple hierarchical select 7

Wrapper around drupal_valid_token().

Parameters

string $token: The token to validate.

array $params: Additional params to generate the token key.

  • field_name: (required) Name of field the token has been generated for.

Return value

bool TRUE if the token is valid, FALSE otherwise.

See also

drupal_valid_token()

1 string reference to 'shs_json_valid_token'
shs_json_callbacks in ./shs.module
Get a list of supported JSON callbacks.

File

./shs.module, line 127
Provides an additional widget for term fields to create hierarchical selects.

Code

function shs_json_valid_token($token, array $params) {
  if (empty($params['field_name'])) {
    $t_args = array(
      '%param' => 'field_name',
      '%function' => 'shs_json_valid_token',
    );
    watchdog('shs', 'Missing mandantory token parameter "%param" in %function', $t_args, WATCHDOG_ERROR);
    return FALSE;
  }
  $token_key = 'shs-' . $params['field_name'];
  return drupal_valid_token($token, $token_key);
}