request = $request; } /** * @return TwigFunction[] */ public function getFunctions(): array { $isSafeHtml = ['is_safe' => ['html']]; return [ new TwigFunction('menu', 'make_navigation', $isSafeHtml), new TwigFunction('menuUserShiftState', 'User_shift_state_render', $isSafeHtml), new TwigFunction('menuUserMessages', 'user_unread_messages', $isSafeHtml), new TwigFunction('menuUserHints', 'header_render_hints', $isSafeHtml), new TwigFunction('menuUserSubmenu', 'make_user_submenu', $isSafeHtml), new TwigFunction('page', [$this, 'getPage']), new TwigFunction('msg', 'msg', $isSafeHtml), ]; } /** * @return string */ public function getPage(): string { if ($this->request->has('p')) { return $this->request->get('p'); } return $this->request->path(); } }