private function SplashifyInjection::checkWhere in Splashify 8.2
Check if the current page pass the conditions in the group.
Parameters
$group:
Return value
bool
1 call to SplashifyInjection::checkWhere()
- SplashifyInjection::getPageGroups in src/
Service/ SplashifyInjection.php - Received all of splash groups that can be displayed on the current page.
File
- src/
Service/ SplashifyInjection.php, line 261
Class
- SplashifyInjection
- Class SplashifyInjection.
Namespace
Drupal\splashify\ServiceCode
private function checkWhere($group) {
$where = $group
->getWhere();
switch ($where) {
case 'all':
return TRUE;
case 'home':
$is_front = \Drupal::service('path.matcher')
->isFrontPage();
return $group
->isOpposite() ? !$is_front : $is_front;
case 'list':
$pages = Unicode::strtolower($group
->getListPages());
$path = \Drupal::service('path.current')
->getPath();
// Do not trim a trailing slash if that is the complete path.
$path = $path === '/' ? $path : rtrim($path, '/');
$path_alias = Unicode::strtolower(\Drupal::service('path.alias_manager')
->getAliasByPath($path));
$path_matcher = \Drupal::service('path.matcher');
$is_match = $path_matcher
->matchPath($path_alias, $pages) || $path != $path_alias && $path_matcher
->matchPath($path, $pages);
return $group
->isOpposite() ? !$is_match : $is_match;
}
return TRUE;
}