bitbag_sylius_cms_plugin_admin_section:
    resource: |
        alias: bitbag_sylius_cms_plugin.section
        section: admin
        templates: '@BitBagSyliusCmsPlugin/CrudUi'
        redirect: update
        grid: bitbag_sylius_cms_plugin_admin_section
        except: ['show']
        permission: true
        vars:
            all:
                header: bitbag_sylius_cms_plugin.ui.sections_header
                subheader: bitbag_sylius_cms_plugin.ui.sections_subheader
                templates:
                    form: "@BitBagSyliusCmsPlugin/Section/Crud/_form.html.twig"
            index:
                icon: grid layout
    type: sylius.resource

bitbag_sylius_cms_plugin_admin_ajax_section_by_name_phrase:
    path: /ajax/sections/search
    methods: [GET]
    defaults:
        _format: json
        _controller: bitbag_sylius_cms_plugin.controller.section:indexAction
        _sylius:
            serialization_groups: [Autocomplete]
            permission: true
            repository:
                method: findByNamePart
                arguments:
                    phrase: $phrase
                    locale: null

bitbag_sylius_cms_plugin_admin_ajax_section_by_code:
    path: /ajax/sections/code
    methods: [GET]
    defaults:
        _format: json
        _controller: bitbag_sylius_cms_plugin.controller.section:indexAction
        _sylius:
            serialization_groups: [Autocomplete]
            permission: true
            repository:
                method: findBy
                arguments: [code: $code]
