plugin/forum/Listener/Resource/ForumListener.php
public function onOpen(LoadResourceEvent $event)
    {
        $forum = $event->getResource();
        $user = $this->tokenStorage->getToken()->getUser();
        $isValidatedUser = false;

        if ('anon.' !== $user) {
            $validationUser = $this->manager->getValidationUser($user, $forum);
            $isValidatedUser = $validationUser->getAccess();
        }

        $event->setData([
            'forum' => $this->serializer->serialize($forum),
            'isValidatedUser' => $isValidatedUser,
        ]);

        $event->stopPropagation();
    }
public function onOpen(LoadResourceEvent $event)
    {
        $forum = $event->getResource();
        $user = $this->tokenStorage->getToken()->getUser();
        $isValidatedUser = false;

        if ('anon.' !== $user) {
            $validationUser = $this->manager->getValidationUser($user, $forum);
            $isValidatedUser = $validationUser->getAccess();
        }

        $event->setData([
            'forum' => $this->serializer->serialize($forum),
            'isValidatedUser' => $isValidatedUser,
        ]);

        $event->stopPropagation();
    }
public function onOpen ( LoadResourceEvent $ event ) { $ forum = $ event -> getResource ( ) ; $ user = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; $ isValidatedUser = false ; if ( 'anon.' !== $ user ) { $ validationUser = $ this -> manager -> getValidationUser ( $ user , $ forum ) ; $ isValidatedUser = $ validationUser -> getAccess ( ) ; } $ event -> setData ( [ 'forum' => $ this -> serializer -> serialize ( $ forum ) , 'isValidatedUser' => $ isValidatedUser , ] ) ; $ event -> stopPropagation ( ) ; }
Loads a Forum resource.

@DI\Observe("resource.claroline_forum.load")

@param LoadResourceEvent $event
Loads a Forum resource .