public function SitewideAlert::getPagesToShowOn in Sitewide Alert 8
Gets the pages to show on.
Return value
array The patterns of pages to show on.
Overrides SitewideAlertInterface::getPagesToShowOn
File
- src/
Entity/ SitewideAlert.php, line 486
Class
- SitewideAlert
- Defines the Sitewide Alert entity.
Namespace
Drupal\sitewide_alert\EntityCode
public function getPagesToShowOn() : array {
$paths = [];
$pagesString = $this
->get('limit_to_pages')->value;
// If it has not been set return no restrictions.
if (!$pagesString) {
return $paths;
}
foreach (explode("\n", strip_tags($pagesString)) as $path) {
$path = trim($path);
if (!empty($path) && strpos($path, '/') === 0) {
$paths[] = $path;
}
}
return $paths;
}