sylius_admin_taxon:
    resource: |
        alias: sylius.taxon
        section: admin
        templates: "@SyliusAdmin\\Taxon"
        except: ['show', 'index']
        redirect: update
        permission: true
        vars:
            all:
                subheader: sylius.ui.manage_categorization_of_your_products
                templates:
                    form: "@SyliusAdmin/Taxon/_form.html.twig"
    type: sylius.resource

sylius_admin_taxon_index:
    path: /taxons/
    methods: [GET]
    defaults:
        _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
        route: sylius_admin_taxon_create
        permanent: true

sylius_admin_taxon_create_for_parent:
    path: /taxons/new/{id}
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.taxon::createAction
        _sylius:
            section: admin
            permission: true
            template: '@SyliusAdmin/Taxon/create.html.twig'
            redirect: sylius_admin_taxon_update
            factory:
                method: createForParent
                arguments: ['expr:notFoundOnNull(service("sylius.repository.taxon").find($id))']
            vars:
                subheader: sylius.ui.manage_categorization_of_your_products
                templates:
                    form: "@SyliusAdmin/Taxon/_form.html.twig"
