public function AuthcacheP13nDefaultRequestUrlGenerator::url in Authenticated User Page Caching (Authcache) 7.2
Generate an url for the given request and parameter.
@returns array An associative array consisting of the following key-value pairs:
- path: A relative or absolute URL without query or fragment suitable for supplying to the $path parameter of the drupal url() function.
- options: An associative array containing the options as accepted by the $options parameter of the drupal url() function.
Overrides AuthcacheP13nRequestUrlGeneratorInterface::url
See also
url()
File
- modules/
authcache_p13n/ includes/ AuthcacheP13nDefaultRequestUrlGenerator.inc, line 51 - Defines request URL generator.
Class
- AuthcacheP13nDefaultRequestUrlGenerator
- Interface for request url generators.
Code
public function url($route_id, $arg) {
$query = array(
'a' => $arg,
'r' => $route_id,
);
// Add path for per-page caching.
if ($this->cacheGranularity
->is(AuthcacheP13nCacheGranularity::PER_PAGE)) {
$query['o'] = $_GET;
}
else {
$query['o'] = array(
'q' => '',
);
}
// Add language specific URL prefix if there is any.
url('', array(
'prefix' => &$prefix,
));
$query['o']['q'] = $prefix . $query['o']['q'];
return array(
'path' => $this->frontControllerURL,
'options' => array(
'external' => TRUE,
'query' => $query,
),
);
}