private static function PathChecker::collectAlias in Optimizely 8
Same name and namespace in other branches
- 8.0 src/PathChecker.php \Drupal\optimizely\PathChecker::collectAlias()
Lookup all alternatives to the group of paths - alias, <front>.
Parameters
array $paths: A set of paths to be reviewed for alternatives.
Return value
array An updated list of paths that include the additional source and alias values.
1 call to PathChecker::collectAlias()
- PathChecker::uniquePaths in src/
PathChecker.php - Compare target path against the project paths to confirm they're unique.
File
- src/
PathChecker.php, line 216
Class
- PathChecker
- Provides static methods to check path validity, etc.
Namespace
Drupal\optimizelyCode
private static function collectAlias(array $paths) {
// Add alternative values - alias, source, <front> to ensure matches
// also check different possibilities.
foreach ($paths as $path_count => $path) {
// Remove parameters.
if (strpos($path, '?') !== FALSE) {
$path = substr($path, 0, strpos($path, '?'));
$paths[$path_count] = $path;
}
if (self::lookupPathAlias($path)) {
$paths[] = self::lookupPathAlias($path);
}
if (self::lookupSystemPath($path)) {
$paths[] = self::lookupSystemPath($path);
}
// Collect all the possible values to match <front>.
if ($path == '<front>') {
$frontpage = \Drupal::config('system.site')
->get('page.front');
if ($frontpage) {
$paths[] = $frontpage;
$paths[] = self::lookupPathAlias($frontpage);
}
}
}
return $paths;
}