Use case

Usually, you develop your website using one or several custom bundles as this is a best practice. However, dealing with core bundles semantic configuration can be a bit tedious if you maintain it in the main ezpublish/config/ezpublish.yml configuration file.

This recipe will show you how to import configuration from a bundle the manual way and the implicit way.

The manual way

This is the simplest way of doing and it has the advantage to be explicit. The idea is to use the imports statement in your main ezpublish.yml:

imports:
    # Let's import our template selection rules that reside in our custom bundle.
    # MyCustomBundle is the actual bundle name
    - {resource: "@MyCustomBundle/Resources/config/templates_rules.yml"}
 
ezpublish:
    # ...
# Here I need to reproduce the right configuration tree.
# It will be merged with the main one
ezpublish:
    system:
        my_siteaccess:
            ezpage:
                layouts:
                    2ZonesLayout1:
                        name: "2 zones (layout 1)"
                        template: "AcmeTestBundle:zone:2zoneslayout1.html.twig"
    
            location_view:
                full:
                    article_test:
                        template: "AcmeTestBundle:full:article_test.html.twig"
                        match:
                            Id\Location: [144,149]
                    another_test:
                        template: "::another_test.html.twig"
                        match:
                            Id\Content: 142
    
            block_view:
                campaign:
                    template: "AcmeTestBundle:block:campaign.html.twig"
                    match:
                        Type: "Campaign"

During the merge process, if the imported configuration files contain entries that are already defined in the main configuration file, they will override them.

If you want to import configuration for development use only, you can do so in your ezpublish_dev.yml (wink)