parameters:
    bitbag_cms.twig.admin_functions:
        - bitbag_cms_render_block
        - bitbag_cms_render_media
    bitbag_cms.twig.link_template: "@@BitBagSyliusCmsPlugin/Page/link.html.twig"

services:
    bitbag_sylius_cms_plugin.twig.extension.block:
        class: BitBag\SyliusCmsPlugin\Twig\Extension\RenderBlockExtension
        arguments:
            - "@bitbag_sylius_cms_plugin.twig.runtime.block"
        tags:
            - { name: twig.extension }

    bitbag_sylius_cms_plugin.twig.runtime.block:
        class: BitBag\SyliusCmsPlugin\Twig\Runtime\RenderBlockRuntime
        arguments:
            - "@bitbag_sylius_cms_plugin.repository.block"
            - "@bitbag_sylius_cms_plugin.resolver.block_resource"
            - "@twig"
        tags:
            - { name: twig.runtime }

    bitbag_sylius_cms_plugin.twig.extension.media:
        class: BitBag\SyliusCmsPlugin\Twig\Extension\RenderMediaExtension
        arguments:
            - "@bitbag_sylius_cms_plugin.twig.runtime.media"
        tags:
            - { name: twig.extension }

    bitbag_sylius_cms_plugin.twig.runtime.media:
        class: BitBag\SyliusCmsPlugin\Twig\Runtime\RenderMediaRuntime
        arguments:
            - "@bitbag_sylius_cms_plugin.resolver.media_provider"
            - "@bitbag_sylius_cms_plugin.resolver.media_resource"
        tags:
            - { name: twig.runtime }

    bitbag_sylius_cms_plugin.twig.extension.product_pages:
        class: BitBag\SyliusCmsPlugin\Twig\Extension\RenderProductPagesExtension
        arguments:
            - "@bitbag_sylius_cms_plugin.twig.runtime.product_pages"
        tags:
            - { name: twig.extension }

    bitbag_sylius_cms_plugin.twig.runtime.product_pages:
        class: BitBag\SyliusCmsPlugin\Twig\Runtime\RenderProductPagesRuntime
        arguments:
            - "@bitbag_sylius_cms_plugin.repository.page"
            - "@sylius.context.channel"
            - "@twig"
            - "@bitbag_sylius_cms_plugin.sorter.sections"
        tags:
            - { name: twig.runtime }

    bitbag_sylius_cms_plugin.twig.extension.render_content:
        class: BitBag\SyliusCmsPlugin\Twig\Extension\RenderContentExtension
        tags:
            - { name: twig.extension }

    bitbag_sylius_cms_plugin.twig.runtime.render_content:
        class: BitBag\SyliusCmsPlugin\Twig\Runtime\RenderContentRuntime
        arguments:
            - "@bitbag_sylius_cms_plugin.twig.parser.content"
        tags:
            - { name: twig.runtime }

    bitbag_sylius_cms_plugin.twig.parser.content:
        class: BitBag\SyliusCmsPlugin\Twig\Parser\ContentParser
        arguments:
            - "@twig"
            - "%bitbag_cms.twig.admin_functions%"

    bitbag_sylius_cms_plugin.twig.extension.render_link:
        class: BitBag\SyliusCmsPlugin\Twig\Extension\RenderLinkExtension
        tags:
            - { name: twig.extension }

    bitbag_sylius_cms_plugin.twig.runtime.render_link:
        class: BitBag\SyliusCmsPlugin\Twig\Runtime\RenderLinkRuntime
        arguments:
            - "@sylius.context.locale"
            - "@bitbag_sylius_cms_plugin.repository.page"
            - "@router.default"
            - "%bitbag_cms.twig.link_template%"
        tags:
            - { name: twig.runtime }
