public function ViewportResolver::isPathSelected in Viewport 8
Checks if the given path (or current path) needs a custom viewport tag.
Return value
bool Whether the given path needs to use a custom viewport or not.
Overrides ViewportResolverInterface::isPathSelected
File
- src/
ViewportResolver.php, line 54
Class
- ViewportResolver
- Provides a ViewportResolver.
Namespace
Drupal\viewportCode
public function isPathSelected($path = NULL) {
if (is_null($path)) {
$path = $this->currentPathStack
->getPath();
}
// Normalise the pages selected and the path looked for.
$path = strtolower($path);
$viewport_pages = strtolower($this->viewportSettings
->get('selected_pages'));
// Check if current path is in the pages selected to have a custom viewport.
$page_match = $this->pathMatcher
->matchPath($path, $viewport_pages);
return $page_match;
}