eZ Community » Forums » eZ Publish 5 Platform » Probleme with routing config
expandshrink

Probleme with routing config

Probleme with routing config

Monday 13 November 2017 5:42:01 pm - 3 replies

Hello everyone.

I struggle to configure the routing on a project.

My configuration files are not taken into account and I do not understand why.

 

template_rules.yml

 # https://doc.ez.no/display/EZP/Import+settings+from+a+bundle
# We explicitly prepend config for "ezpublish" namespace in service container extension,
# so no need to repeat it here
# Configuration ajouté sous la clef principale : ezpublish
#ezpublish:
system:
    front_group:
        location_view:
                gamme:
                    controller: "ClientFrontEndBundle:Gamme:viewLocation"
                    template: "ClientFrontEndBundle:full:gamme.html.twig"
                    match:
                        Identifier\ContentType: "range"

 
legacy_settings.yml

 # Configuration ajouté sous la clef principale : ez_publish_legacy
#ez_publish_legacy:
system:
    default:
        templating:
            view_layout: "ClientFrontEndBundle::pagelayout.html.twig"
            module_layout: "ClientFrontEndBundle::pagelayout_legacy.html.twig"

 

ClientFrontEndExtension.php

 class ClientFrontEndExtension extends Extension implements PrependExtensionInterface
{
    public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new YamlFileLoader(
            $container,
            new FileLocator( __DIR__ . '/../Resources/config' )
        );
        $loader->load( 'services.yml' ); // OK
    }
    public function prepend( ContainerBuilder $container )
    {
        $legacyConfigFile = __DIR__ . '/../Resources/config/legacy_settings.yml';
        $config = Yaml::parse( file_get_contents( $legacyConfigFile ) );
        $container->prependExtensionConfig( 'ez_publish_legacy', $config );
        $container->addResource( new FileResource( $legacyConfigFile ) );
//        // https://doc.ez.no/display/EZP/Import+settings+from+a+bundle
//        // Loading our YAML file containing our template rules
//        $configFile = __DIR__ . '/../Resources/config/template_rules.yml';
//        $config = Yaml::parse( file_get_contents( $configFile ) );
//        // We explicitly prepend loaded configuration for "ezpublish" namespace.
//        // So it will be placed under the "ezpublish" configuration key, like in ezpublish.yml.
//        $container->prependExtensionConfig( 'ezpublish', $config );
//        $container->addResource( new FileResource( $configFile ) );
        
        $config = Yaml::parse( __DIR__ . '/../Resources/config/template_rules.yml' );
        $container->prependExtensionConfig( 'ezpublish', $config );
    }
}

I have found contradictory sources on how to add files in the prepend () function.

 

I would like my front to be managed as much as possible in ez5.

 

My dependencies:

 "symfony/symfony": "~2.7",
"ezsystems/ezpublish-kernel": ">=2014.11",
"ezsystems/ezpublish-legacy": ">=2014.11",

Modified on Monday 13 November 2017 5:49:07 pm by Rémy PHP

Monday 13 November 2017 5:51:33 pm

On front url I have a legay render : extension/ezdemo/design/ezdemo/templates/node/view/full.tpl

Tuesday 14 November 2017 9:37:42 am

I also tested the manual way : https://doc.ez.no/display/EZP/Import+settings+from+a+bundle

 

ezpublish/config/ezpublish.yml

 imports:
    - { resource: @ClientFrontEndBundle/Resources/config/client.yml }
    - { resource: @ClientFrontEndBundle/Resources/config/template_rules.yml }
    - { resource: @ClientFrontEndBundle/Resources/config/legacy_settings.yml }
 
ezpublish:
    system:
        # ...

src/Client/FrontEndBundle/Resources/config/template_rules.yml

 ezpublish:
    system:
        front_group:
            location_view:
                full:
                    gamme:
                        controller: "ClientFrontEndBundle:Gamme:viewLocation"
                        template: "ClientFrontEndBundle:full:gamme.html.twig"
                        match:
                            Identifier\ContentType: "range"

src/Client/FrontEndBundle/Resources/config/client.yml

 ezpublish:
    system:
        default:
            content_view:
                carousel:
                    carousel_element:
                        template: "ClientFrontEndBundle:carousel:carousel_element.html.twig"
                        match:
                            Identifier\ContentType: [carousel_element]

 

But it still displays a legacy template:

  START: including template: extension/ezdemo/design/ezdemo/templates/node/view/full.tpl (design:node/view/full.tpl)

 

My controller

 class GammeController extends Controller
{
    public function viewLocation( $locationId, $viewType, $layout = false, array $params = array() )
    {
        $logger = $this->get('logger');
        $logger->notice('$locationId='.$locationId);
        $logger->notice('$viewType='.$viewType);
        $logger->notice('$layout='.$layout);
        $logger->notice('$params='.var_export($params,1));
        return $this->get( 'ez_content' )->viewLocation( $locationId, $viewType, $layout, $params );
    }
}

Modified on Tuesday 14 November 2017 9:43:23 am by Rémy PHP

Tuesday 14 November 2017 5:25:20 pm

Bon.. J'ai réussit.

 

Mais je ne saurais dire comment...

 

Sujet clos.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from