Commit 263ca06a authored by Tino Goratsch's avatar Tino Goratsch

minor code quality improvement

parent 03ede877
......@@ -49,20 +49,7 @@ class PageCssClasses extends AbstractFilter
{
if (strpos($tplOutput, '<body') !== false) {
if ($this->cssClassCache === '') {
$pieces = [
$this->pageCssClasses->getModule(),
$this->pageCssClasses->getControllerAction()
];
if ($this->request->getArea() === Core\Controller\AreaEnum::AREA_ADMIN) {
$pieces[] = 'in-admin';
} elseif ($this->request->isHomepage() === true) {
$pieces[] = 'is-homepage';
} else {
$pieces[] = $this->pageCssClasses->getDetails();
}
$this->cssClassCache = 'class="' . implode(' ', $pieces) . '"';
$this->cssClassCache = 'class="' . implode(' ', $this->buildPageCssClasses()) . '"';
}
$tplOutput = str_replace('<body', '<body ' . $this->cssClassCache, $tplOutput);
......@@ -70,4 +57,25 @@ class PageCssClasses extends AbstractFilter
return $tplOutput;
}
/**
* @return array
*/
protected function buildPageCssClasses()
{
$pieces = [
$this->pageCssClasses->getModule(),
$this->pageCssClasses->getControllerAction()
];
if ($this->request->getArea() === Core\Controller\AreaEnum::AREA_ADMIN) {
$pieces[] = 'in-admin';
} elseif ($this->request->isHomepage() === true) {
$pieces[] = 'is-homepage';
} else {
$pieces[] = $this->pageCssClasses->getDetails();
}
return $pieces;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment