services = $services; $this->config = $services->config; } public function getName() { return 'userfrosting/account'; } public function getFunctions() { return array( // Add Twig function for checking permissions during dynamic menu rendering new \Twig_SimpleFunction('checkAccess', function ($slug, $params = []) { $authorizer = $this->services->authorizer; $currentUser = $this->services->currentUser; return $authorizer->checkAccess($currentUser, $slug, $params); }), new \Twig_SimpleFunction('checkAuthenticated', function () { $authenticator = $this->services->authenticator; return $authenticator->check(); }) ); } public function getGlobals() { try { $currentUser = $this->services->currentUser; } catch (\Exception $e) { $currentUser = NULL; } return [ 'current_user' => $currentUser ]; } }