You are here

function hook_query_parameters_to_url_rewrite_access in Query Parameters To URL 7

Given path and contextual data, decide if path rewriting should be done.

Might be called from hook_url_inbound_alter() or hook_url_outbound_alter(). Depending on that, passed contextual data can differ.

Parameters

$path String The path to rewrite.:

$options Array An array of url options in outbound alter.:

$original_path String|Null The original path before altering.:

$path_language String|Null The path language in inbound alter.:

Return value

string

1 invocation of hook_query_parameters_to_url_rewrite_access()
query_parameters_to_url_path_should_be_rewritten in ./query_parameters_to_url.module
Check whether given path should be rewritten.

File

./query_parameters_to_url.api.php, line 20
API documentation for Query Parameters to URL module.

Code

function hook_query_parameters_to_url_rewrite_access($path, $options, $original_path, $path_language) {

  // Allow path rewriting on the special dashboard page.
  if ($path == 'special-dashboard') {
    return QUERY_PARAMETERS_TO_URL_REWRITE_ALLOW;
  }

  // Deny rewriting on the events page, if a special query parameter is set.
  if ($path == 'events' && isset($options['query']['special_parameter']) && $options['query']['special_argument'] == TRUE) {
    return QUERY_PARAMETERS_TO_URL_REWRITE_DENY;
  }

  // Ignore otherwise.
  return QUERY_PARAMETERS_TO_URL_REWRITE_IGNORE;
}