Fix nav sidebar on admin page.
This commit is contained in:
parent
316eb03a4c
commit
dac19b11b7
|
@ -18,7 +18,7 @@ final class IndexAction
|
|||
$view = $request->getView();
|
||||
|
||||
// Remove the sidebar on the homepage.
|
||||
$view->addData(['sidebar' => null]);
|
||||
$view->getSections()->unset('sidebar');
|
||||
|
||||
$view = $request->getView();
|
||||
$viewData = $view->getData();
|
||||
|
|
|
@ -9,8 +9,10 @@ use LogicException;
|
|||
|
||||
/**
|
||||
* A global section container for templates.
|
||||
*
|
||||
* @implements \ArrayAccess<string, string>
|
||||
*/
|
||||
final class GlobalSections
|
||||
final class GlobalSections implements \ArrayAccess
|
||||
{
|
||||
private int $sectionMode = Template::SECTION_MODE_REWRITE;
|
||||
private array $sections = [];
|
||||
|
@ -21,11 +23,31 @@ final class GlobalSections
|
|||
return !empty($this->sections[$section]);
|
||||
}
|
||||
|
||||
public function offsetExists(mixed $offset): bool
|
||||
{
|
||||
return $this->has((string)$offset);
|
||||
}
|
||||
|
||||
public function get(string $section, ?string $default = null): ?string
|
||||
{
|
||||
return $this->sections[$section] ?? $default;
|
||||
}
|
||||
|
||||
public function offsetGet(mixed $offset): mixed
|
||||
{
|
||||
return $this->get((string)$offset);
|
||||
}
|
||||
|
||||
public function unset(string $section): void
|
||||
{
|
||||
unset($this->sections[$section]);
|
||||
}
|
||||
|
||||
public function offsetUnset(mixed $offset): void
|
||||
{
|
||||
$this->unset((string)$offset);
|
||||
}
|
||||
|
||||
public function set(
|
||||
string $section,
|
||||
?string $value,
|
||||
|
@ -40,6 +62,11 @@ final class GlobalSections
|
|||
};
|
||||
}
|
||||
|
||||
public function offsetSet(mixed $offset, mixed $value): void
|
||||
{
|
||||
$this->set((string)$offset, (string)$value);
|
||||
}
|
||||
|
||||
public function prepend(string $section, ?string $value): void
|
||||
{
|
||||
$this->set($section, $value, Template::SECTION_MODE_PREPEND);
|
||||
|
|
Loading…
Reference in New Issue