SonataPageBundle没有为矩阵区域定义容器"标题"

时间:2016-11-23 15:11:17

标签: symfony sonata-admin sonata

我已经安装了sonatapagebundle并生成了所有路由。 但是当我尝试配置奏鸣曲页面作曲家时,我只有错误: 没有为矩阵区域定义容器"标题"

这可能是sonata_page配置:

sonata_page:
    multisite: host
    use_streamed_response: true # set the value to false in debug mode or if the reverse proxy does not handle streamed response
    ignore_route_patterns:
        - ^(.*)admin(.*)   # ignore admin route, ie route containing 'admin'
        - ^_(.*)          # ignore symfony routes
    ignore_routes:
        - sonata_page_cache_esi
        - sonata_page_cache_ssi
        - sonata_page_js_sync_cache
        - sonata_page_js_async_cache
        - sonata_cache_esi
        - sonata_cache_ssi
        - sonata_cache_js_async
        - sonata_cache_js_sync
        - sonata_cache_apc
    ignore_uri_patterns:
        - ^/admin\/   # ignore admin route, ie route containing 'admin'
    page_defaults:
        homepage: {decorate: false} # disable decoration for homepage, key - is a page route
    default_template: default # template key from templates section, used as default for pages
    templates:
        default:
            path: 'ApplicationSonataPageBundle::demo_layout.html.twig'
            name: 'default'
            containers:
                header:
                    name: Header
                content_top:
                    name: Top content
                content:
                    name: Main content
                content_bottom:
                    name: Bottom content
                footer:
                    name: Footer
            matrix:
                layout: |
                    HHHHHHHH
                    TTTTTTTT
                    TTTTTTTT
                    CCCCCCCC
                    CCCCCCCC
                    BBBBBBBB
                    BBBBBBBB
                    FFFFFFFF

                mapping:
                    H: header
                    T: content_top
                    C: content
                    B: content_bottom
                    F: footer
        2columns:
            path: 'ApplicationSonataPageBundle::demo_2columns_layout.html.twig'
            name: '2 columns layout'
            inherits_containers: default
            containers:
                left_col:
                    name: Left column
                    blocks:
                        - sonata.media.block.media
                        - sonata.media.block.gallery
                        - sonata.media.block.feature_media
                right_col:
                    name: Right column
                    blocks:
                        - sonata.news.block.recent_posts
                        - sonata.order.block.recent_orders
                        - sonata.product.block.recent_products
            matrix:
                layout: |

                    HHHHHHHHHH
                    TTTTTTTTTT
                    TTTTTTTTTT
                    LLLCCCCRRR
                    LLLCCCCRRR
                    BBBBBBBBBB
                    BBBBBBBBBB
                    FFFFFFFFFF

                mapping:
                   H: header
                   T: content_top
                   L: left_col
                   R: right_col
                   C: content
                   B: content_bottom
                   F: footer

    # manage the http errors
    catch_exceptions:
        not_found: [404]    # render 404 page with "not_found" key (name generated: _page_internal_error_{key})
        fatal:     [500]    # so you can use the same page for different http errors or specify specific page for each error

有什么想法吗? 此致

1 个答案:

答案 0 :(得分:0)

好的我资助了什么错。这是正确的配置:

sonata_page:
    multisite:             host # host
    use_streamed_response: false # set the value to false in debug mode or if the reverse proxy does not handle streamed response

    ignore_uri_patterns:
        - ^/admin(.*)
        - ^/api/(.*)

    ignore_route_patterns:
        - (.*)admin(.*)     # ignore admin route, ie route containing 'admin'
        - ^_(.*)            # ignore symfony routes

    ignore_routes:
        - sonata_page_cache_esi
        - sonata_page_cache_ssi
        - sonata_page_js_sync_cache
        - sonata_page_js_async_cache
        - sonata_cache_esi
        - sonata_cache_ssi
        - sonata_cache_js_async
        - sonata_cache_js_sync
        - sonata_cache_apc

    cache_invalidation:
        service:  sonata.page.cache.invalidation.simple
        recorder: sonata.page.cache.recorder
        classes:
            "Application\Sonata\PageBundle\Entity\Block": getId

    default_template: default
    templates:
        default:
          path: 'ApplicationSonataPageBundle::demo_layout.html.twig'
          name: 'default'
          containers:
             header:
                 name: Header
             content_top:
                 name: Top content
             content:
                 name: Main content
             content_bottom:
                 name: Bottom content
             footer:
                 name: Footer

          matrix:
             layout: |

                 HHHHHHHH
                 TTTTBBBB
                 TTTTBBBB
                 TTTTBBBB
                 TTTTBBBB
                 CCCCCCCC
                 CCCCCCCC
                 FFFFFFFF

             mapping:
                 H: header
                 T: content_top
                 C: content
                 B: content_bottom
                 F: footer

        2columns: { path: 'ApplicationSonataPageBundle::demo_2columns_layout.html.twig', name: '2 columns layout' }

    page_defaults:
        homepage: { decorate: false, enabled: true }