How to add bundles in the Admin Dashboard Symfony2

时光总嘲笑我的痴心妄想 提交于 2019-12-12 01:29:45

问题


I'm working on Sonata Admin bundles. I've configure the Admin Dashboard and the following components are showing in the "Symfony CMF" group,

Here's the snapshot,

I've gone through the Symfony CMF sandbox site, http://cmf.liip.ch/en/admin/dashboard

In this dashboard there are some other bundles like , Simple Block Container Block etc are appearing.

Here's the snapshot,

I want to add the Content items as shown in the above pic in my "Symfony CMF" group.

How to do it ?

Here's my config.yml,

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }    
    - { resource: @IFISBMainBundle/Resources/config/admin.yml }
    - { resource: doctrine_extensions.yml }

framework:
    #esi:             ~
    translator:      { fallback: en }
    secret:          %secret%
    router:          { resource: "%kernel.root_dir%/config/routing.yml" }
    form:            true
    templating:      { engines: ['twig'] } #assets_version: SomeVersionScheme
    default_locale:  %locale%
    session:         ~

# Twig Configuration
twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%

# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    #bundles:        [CmfSimpleCmsBundle, CmfCreateBundle]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #lessphp:
            #file: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php
            #apply_to: "\.less$"
        #closure:
        #    jar: %kernel.root_dir%/Resources/java/compiler.jar
        #yui_css:
        #    jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar

# for jackalope-doctrine-dbal
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        path:     %database_path%
        charset:  UTF8
        types:
            json: Sonata\Doctrine\Types\JsonType

    orm:
        entity_managers:
            default:
                auto_mapping: true
                mappings:
                    ApplicationSonataUserBundle: ~
                    SonataUserBundle: ~
                    loggable:
                        type: annotation
                        alias: Gedmo
                        prefix: Gedmo\Loggable\Entity
                        dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"

# cmf configuration
doctrine_phpcr:
    # configure the PHPCR session
    session:
        backend: 
            type: %phpcr_backend%
        workspace: %phpcr_workspace%
        username: %phpcr_user%
        password: %phpcr_pass%
    # enable the ODM layer
    odm:
        auto_mapping: true
        auto_generate_proxy_classes: %kernel.debug%
        locales:
            en:
                - de
            de:
                - en

liip_doctrine_cache:
    namespaces:
        meta:
            type: file_system
        nodes:
            type: file_system

cmf_core:
    persistence:
        phpcr:
            enabled: true
            basepath: /cms
    publish_workflow:
        enabled: false
    multilang:
        locales: %locales%

cmf_create:
    editor_base_path: /bundles/cmfcreate/vendor/ckeditor/

cmf_simple_cms:
    routing:
        templates_by_class:
            Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page: CmfSimpleCmsBundle:Page:index.html.twig
        controllers_by_class:
            Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute: cmf_routing.redirect_controller:redirectAction
cmf_routing:
    chain:
        routers_by_id:
            cmf_routing.dynamic_router: 20
            router.default: 100
    dynamic:
        enabled: true
        persistence:
            phpcr:
                route_basepath: /cms/routes

knp_menu:
    twig: true

lunetics_locale:
    strict_mode: true
    guessing_order:
        - cookie
        - router
        - browser
    allowed_locales: %locales%

sonata_block:
    default_contexts: [cms]
    blocks:
        sonata.user.block.menu:    # used to display the menu in profile pages
        sonata.user.block.account: # used to display menu option (login option)
        sonata.block.service.text:
        sonata.block.service.rss:
        sonata.admin.block.admin_list:
            contexts:   [admin]
        sonata_admin_doctrine_phpcr.tree_block:
            settings:
                id: '/cms'
            contexts:   [admin]

sonata_admin:
    title: Admin
    title_logo: bundles/acmemain/images/if_logo_small.gif 
    templates:
        # default global templates
        ajax:    SonataAdminBundle::ajax_layout.html.twig

    dashboard:
        blocks:
            # display a dashboard block
            - { position: right, type: sonata.admin.block.admin_list }
            - { position: left, type: sonata_admin_doctrine_phpcr.tree_block }


sonata_doctrine_phpcr_admin:
    document_tree:
        Doctrine\ODM\PHPCR\Document\Generic:
            valid_children:
                - all
        Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
            valid_children:
                - all
        Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route:
            valid_children:
                - Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route
                - Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute
        Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute:
            valid_children: []
        Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode:
            valid_children:
                - Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode
swiftmailer:
    transport:            gmail
    username:             witribeman@gmail.com
    password:             headphones
    logging:              "%kernel.debug%"

fos_user:

    db_driver:      orm # can be orm or odm
    firewall_name:  main
    user_class:     Application\Sonata\UserBundle\Entity\User


    group:
        group_class: Application\Sonata\UserBundle\Entity\Group            
    from_email:
        address:        noreply@ifi-admin.com
        sender_name:    IFI Admin        

sonata_user:
    security_acl: true
    manager_type: orm # can be orm or mongodb
    class:
        user: Application\Sonata\UserBundle\Entity\User

I'm also confused from where and how Symfony CMF group items gets rendered.

Kindly, let me know how to add other CMF bundle under my Symfony CMF group.

Thanks, Faisal Nasir


回答1:


Put your entity service in dashboard

 dashboard:
    blocks:
        # display a dashboard block
        - { position: left, type: sonata.admin.block.admin_list, settings: { groups: [Personnel,Settings] } }
        - { position: right, type: sonata.admin.block.admin_list }
    groups:
        Personnel: #Menu name
            items: 
                - example.abc.a #your services
        Settings: #Menu name
            items:
                - example.abc.a #your services


来源:https://stackoverflow.com/questions/20250231/how-to-add-bundles-in-the-admin-dashboard-symfony2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!