services:
    oro_layout.twig.extension.layout:
        class: Oro\Bundle\LayoutBundle\Twig\LayoutExtension
        arguments:
            - '@oro_platform.twig.service_locator'
            - '@Doctrine\Inflector\Inflector'
        tags:
            - { name: twig.extension }

    oro_layout.twig.renderer:
        class: Oro\Bundle\LayoutBundle\Twig\TwigRenderer
        arguments:
            - '@oro_layout.twig.renderer.engine'
            - '@oro_layout.layout_context_stack'
            - '@oro_layout.cache.render_cache'
            - '@oro_layout.cache.placeholder_renderer'
            - '@twig'
        calls:
            - [setLogger, ['@logger']]
        tags:
            - { name: twig.runtime }
            - { name: monolog.logger, channel: oro_layout }

    oro_layout.twig.renderer.engine:
        class: Oro\Bundle\LayoutBundle\Form\TwigRendererEngine
        arguments:
            - '%oro_layout.twig.resources%'
            - '@twig'
        calls:
            - [setConfigManager, ['@oro_config.user']]

    oro_layout.twig.layout_renderer:
        class: Oro\Bundle\LayoutBundle\Layout\TwigLayoutRenderer
        arguments:
            - '@oro_layout.twig.renderer'
            - '@twig.form.engine'
            - '@twig'
            - '@oro_layout.cache.placeholder_renderer'

    oro_layout.twig.form.engine:
        class: Oro\Bundle\LayoutBundle\Form\RendererEngine\TwigRendererEngine
        decorates: 'twig.form.engine'
        parent: 'twig.form.engine'

    oro_layout.event_listener.layout_context_changed:
        class: Oro\Bundle\LayoutBundle\EventListener\LayoutContextChangedListener
        arguments:
            - '@oro_layout.twig.layout_renderer'
        tags:
            - { name: kernel.event_listener, event: Oro\Bundle\LayoutBundle\Event\LayoutContextChangedEvent, method: onContextChanged }
