src/Sulu/Bundle/AdminBundle/Controller/AdminController.php
public function configAction(): Response
    {
        $user = $this->tokenStorage->getToken()->getUser();
        $contact = $this->contactManager->getById($user->getContact()->getId(), $user->getLocale());

        $view = View::create([
            'sulu_admin' => [
                'endpoints' => [
                    'metadata' => $this->urlGenerator->generate(
                        'sulu_admin.metadata',
                        ['type' => ':type', 'key' => ':key']
                    ),
                ],
                'fieldTypeOptions' => $this->fieldTypeOptionRegistry->toArray(),
                'internalLinkTypes' => $this->linkProviderPool->getConfiguration(),
                'navigation' => $this->navigationRegistry->getNavigation()->getChildrenAsArray(),
                'routes' => $this->routeRegistry->getRoutes(),
                'resources' => $this->resources,
                'smartContent' => array_map(function(DataProviderInterface $dataProvider) {
                    return $dataProvider->getConfiguration();
                }, $this->dataProviderPool->getAll()),
                'user' => $user,
                'contact' => $contact,
            ],
            'sulu_contact' => [
                'addressTypes' => $this->managerRegistry->getRepository('SuluContactBundle:AddressType')->findAll(),
                'countries' => $this->managerRegistry->getRepository('SuluContactBundle:Country')->findAll(),
            ],
            'sulu_media' => [
                'endpoints' => [
                    'image_format' => $this->urlGenerator->generate(
                        'sulu_media.redirect',
                        ['id' => ':id']
                    ),
                ],
            ],
            'sulu_preview' => [
                'endpoints' => [
                    'start' => $this->urlGenerator->generate('sulu_preview.start'),
                    'render' => $this->urlGenerator->generate('sulu_preview.render'),
                    'update' => $this->urlGenerator->generate('sulu_preview.update'),
                    'update-context' => $this->urlGenerator->generate('sulu_preview.update-context'),
                    'stop' => $this->urlGenerator->generate('sulu_preview.stop'),
                ],
                'debounceDelay' => $this->previewDelay,
                'mode' => $this->previewMode,
            ],
            'sulu_security' => [
                'endpoints' => [
                    'contexts' => $this->urlGenerator->generate('cget_contexts'),
                ],
            ],
            'sulu_website' => [
                'endpoints' => [
                    'clearCache' => $this->urlGenerator->generate('sulu_website.cache.remove'),
                ],
            ],
        ]);

        $context = new Context();
        $context->setGroups(['frontend', 'partialContact', 'fullRoute']);

        $view->setContext($context);
        $view->setFormat('json');

        return $this->viewHandler->handle($view);
    }
public function configAction(): Response
    {
        $user = $this->tokenStorage->getToken()->getUser();
        $contact = $this->contactManager->getById($user->getContact()->getId(), $user->getLocale());

        $view = View::create([
            'sulu_admin' => [
                'endpoints' => [
                    'metadata' => $this->urlGenerator->generate(
                        'sulu_admin.metadata',
                        ['type' => ':type', 'key' => ':key']
                    ),
                ],
                'fieldTypeOptions' => $this->fieldTypeOptionRegistry->toArray(),
                'internalLinkTypes' => $this->linkProviderPool->getConfiguration(),
                'navigation' => $this->navigationRegistry->getNavigation()->getChildrenAsArray(),
                'routes' => $this->routeRegistry->getRoutes(),
                'resources' => $this->resources,
                'smartContent' => array_map(function(DataProviderInterface $dataProvider) {
                    return $dataProvider->getConfiguration();
                }, $this->dataProviderPool->getAll()),
                'user' => $user,
                'contact' => $contact,
            ],
            'sulu_contact' => [
                'addressTypes' => $this->managerRegistry->getRepository('SuluContactBundle:AddressType')->findAll(),
                'countries' => $this->managerRegistry->getRepository('SuluContactBundle:Country')->findAll(),
            ],
            'sulu_media' => [
                'endpoints' => [
                    'image_format' => $this->urlGenerator->generate(
                        'sulu_media.redirect',
                        ['id' => ':id']
                    ),
                ],
            ],
            'sulu_preview' => [
                'endpoints' => [
                    'start' => $this->urlGenerator->generate('sulu_preview.start'),
                    'render' => $this->urlGenerator->generate('sulu_preview.render'),
                    'update' => $this->urlGenerator->generate('sulu_preview.update'),
                    'update-context' => $this->urlGenerator->generate('sulu_preview.update-context'),
                    'stop' => $this->urlGenerator->generate('sulu_preview.stop'),
                ],
                'debounceDelay' => $this->previewDelay,
                'mode' => $this->previewMode,
            ],
            'sulu_security' => [
                'endpoints' => [
                    'contexts' => $this->urlGenerator->generate('cget_contexts'),
                ],
            ],
            'sulu_website' => [
                'endpoints' => [
                    'clearCache' => $this->urlGenerator->generate('sulu_website.cache.remove'),
                ],
            ],
        ]);

        $context = new Context();
        $context->setGroups(['frontend', 'partialContact', 'fullRoute']);

        $view->setContext($context);
        $view->setFormat('json');

        return $this->viewHandler->handle($view);
    }
public function configAction ( ) : Response { $ user = $ this -> tokenStorage -> getToken ( ) -> getUser ( ) ; $ contact = $ this -> contactManager -> getById ( $ user -> getContact ( ) -> getId ( ) , $ user -> getLocale ( ) ) ; $ view = View :: create ( [ 'sulu_admin' => [ 'endpoints' => [ 'metadata' => $ this -> urlGenerator -> generate ( 'sulu_admin.metadata' , [ 'type' => ':type' , 'key' => ':key' ] ) , ] , 'fieldTypeOptions' => $ this -> fieldTypeOptionRegistry -> toArray ( ) , 'internalLinkTypes' => $ this -> linkProviderPool -> getConfiguration ( ) , 'navigation' => $ this -> navigationRegistry -> getNavigation ( ) -> getChildrenAsArray ( ) , 'routes' => $ this -> routeRegistry -> getRoutes ( ) , 'resources' => $ this -> resources , 'smartContent' => array_map ( function ( DataProviderInterface $ dataProvider ) { return $ dataProvider -> getConfiguration ( ) ; } , $ this -> dataProviderPool -> getAll ( ) ) , 'user' => $ user , 'contact' => $ contact , ] , 'sulu_contact' => [ 'addressTypes' => $ this -> managerRegistry -> getRepository ( 'SuluContactBundle:AddressType' ) -> findAll ( ) , 'countries' => $ this -> managerRegistry -> getRepository ( 'SuluContactBundle:Country' ) -> findAll ( ) , ] , 'sulu_media' => [ 'endpoints' => [ 'image_format' => $ this -> urlGenerator -> generate ( 'sulu_media.redirect' , [ 'id' => ':id' ] ) , ] , ] , 'sulu_preview' => [ 'endpoints' => [ 'start' => $ this -> urlGenerator -> generate ( 'sulu_preview.start' ) , 'render' => $ this -> urlGenerator -> generate ( 'sulu_preview.render' ) , 'update' => $ this -> urlGenerator -> generate ( 'sulu_preview.update' ) , 'update-context' => $ this -> urlGenerator -> generate ( 'sulu_preview.update-context' ) , 'stop' => $ this -> urlGenerator -> generate ( 'sulu_preview.stop' ) , ] , 'debounceDelay' => $ this -> previewDelay , 'mode' => $ this -> previewMode , ] , 'sulu_security' => [ 'endpoints' => [ 'contexts' => $ this -> urlGenerator -> generate ( 'cget_contexts' ) , ] , ] , 'sulu_website' => [ 'endpoints' => [ 'clearCache' => $ this -> urlGenerator -> generate ( 'sulu_website.cache.remove' ) , ] , ] , ] ) ; $ context = new Context ( ) ; $ context -> setGroups ( [ 'frontend' , 'partialContact' , 'fullRoute' ] ) ; $ view -> setContext ( $ context ) ; $ view -> setFormat ( 'json' ) ; return $ this -> viewHandler -> handle ( $ view ) ; }
Returns all the configuration for the admin interface.
Returns all the configuration for the admin interface .