ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 5 replies, has 2 voices, and was last updated by  kelton23om 1 year, 9 months ago.

  • Creator
    Topic
  • #14801

    kelton23om
    Participant

    Hi guys, i don’t know how to reload application menu.

    My goal:
    I want to load a specific menu for each entity.

    What i do!
    I describe my own menu and i replace the placehoder by mine.
    for instance i override the block in each template, but i planned to do a generic one.

    Problem:
    the menu does not refresh automatically. But if i reload the page, i can see my modification.

    So, my question is how can i force the refresh ?

    thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #14821
    Dmitry Khrysev
    Dmitry Khrysev
    Oro Core

    Hi.
    After application is loaded, only some of it’s regions are updated during navigation.
    Each region content is provided by content providers

    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/UIBundle/Resources/doc/reference/content-providers.md

    If you need to include some disabled content provider you may do this in 2 ways.
    First is to add _enableContentProviders parameter to you requset with names of providers to enable (in case of main menu this should be mainMenu)

    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/IntegrationBundle/Controller/IntegrationController.php#L164-164

    Second one is to use oro_ui.content_provider.manager service and enable some providers by name.

    #14871

    kelton23om
    Participant

    Hi thanksfor you answer,

    I understand a little better now, but it still doesn’t work :/

    I include the _enableContentProviders in my request like in your example, it seems to be ok.
    but that does not refresh the menu. Should i call something special, any ideas ??

    #14872
    Dmitry Khrysev
    Dmitry Khrysev
    Oro Core

    How new items are added to menu?

    Best way to do this is to subscribe to oro_menu.configure.application_menu event.
    Here is an example of such listener
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/DashboardBundle/EventListener/NavigationListener.php

    #14967

    kelton23om
    Participant

    Thanks again for your answer,

    Use the event seems to be a solution.. i notice that i could add/remove items from the menu so it should be work…

    But in the end what I really want to do is completely change the menu to replace it with the a specific one depending on the context (the entity in the content).

    To resume:
    – There will be a global menu that will be display in a landing page and allow to select only which entity i want to access.(like a wall of apps)
    – Each time i click on a specific entity i load another menu(or refresh the topbar one) with the content of the selected entity only
    – and of course i have a button to return at the landing page.

    My idea will be to describe each menu (global and specific un yml), and just switch the specific one with context..

    if you have any suggestions… it will be great 🙂

    #15028

    kelton23om
    Participant

    hi guys,

    I can now manage my own menu and and select the good tree node from a context. This part work fine.

    But it still remains the refresh problem.

    I enable the “content provider” (i create my own, by the way), but that does not refresh the menu..
    It seems that i need to do something in javascript but i’m not really confident with this part.

    any help ?

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.