main/core/Listener/Tool/HomeListener.php
public function onDisplayWorkspace(DisplayToolEvent $event)
    {
        $orderedTabs = [];
        $workspace = $event->getWorkspace();

        $tabs = $this->finder->search(HomeTab::class, [
            'filters' => ['workspace' => $workspace->getUuid()],
        ]);

        // but why ? finder should never give you an empty row
        $tabs = array_filter($tabs['data'], function ($data) {
            return $data !== [];
        });

        foreach ($tabs as $tab) {
            $orderedTabs[$tab['position']] = $tab;
        }
        ksort($orderedTabs);

        $content = $this->templating->render(
            'ClarolineCoreBundle:tool:home.html.twig', [
                'workspace' => $workspace,
                'editable' => $this->authorization->isGranted(['home', 'edit'], $workspace),
                'context' => [
                    'type' => Widget::CONTEXT_WORKSPACE,
                    'data' => $this->serializer->serialize($workspace),
                ],
                'tabs' => array_values($orderedTabs),
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
public function onDisplayWorkspace(DisplayToolEvent $event)
    {
        $orderedTabs = [];
        $workspace = $event->getWorkspace();

        $tabs = $this->finder->search(HomeTab::class, [
            'filters' => ['workspace' => $workspace->getUuid()],
        ]);

        // but why ? finder should never give you an empty row
        $tabs = array_filter($tabs['data'], function ($data) {
            return $data !== [];
        });

        foreach ($tabs as $tab) {
            $orderedTabs[$tab['position']] = $tab;
        }
        ksort($orderedTabs);

        $content = $this->templating->render(
            'ClarolineCoreBundle:tool:home.html.twig', [
                'workspace' => $workspace,
                'editable' => $this->authorization->isGranted(['home', 'edit'], $workspace),
                'context' => [
                    'type' => Widget::CONTEXT_WORKSPACE,
                    'data' => $this->serializer->serialize($workspace),
                ],
                'tabs' => array_values($orderedTabs),
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
public function onDisplayWorkspace ( DisplayToolEvent $ event ) { $ orderedTabs = [ ] ; $ workspace = $ event -> getWorkspace ( ) ; $ tabs = $ this -> finder -> search ( HomeTab :: class , [ 'filters' => [ 'workspace' => $ workspace -> getUuid ( ) ] , ] ) ; // but why ? finder should never give you an empty row $ tabs = array_filter ( $ tabs [ 'data' ] , function ( $ data ) { return $ data !== [ ] ; } ) ; foreach ( $ tabs as $ tab ) { $ orderedTabs [ $ tab [ 'position' ] ] = $ tab ; } ksort ( $ orderedTabs ) ; $ content = $ this -> templating -> render ( 'ClarolineCoreBundle:tool:home.html.twig' , [ 'workspace' => $ workspace , 'editable' => $ this -> authorization -> isGranted ( [ 'home' , 'edit' ] , $ workspace ) , 'context' => [ 'type' => Widget :: CONTEXT_WORKSPACE , 'data' => $ this -> serializer -> serialize ( $ workspace ) , ] , 'tabs' => array_values ( $ orderedTabs ) , ] ) ; $ event -> setContent ( $ content ) ; $ event -> stopPropagation ( ) ; }
Displays home on Workspace.

@DI\Observe("open_tool_workspace_home")

@param DisplayToolEvent $event
Displays home on Workspace .