OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions onBuildAfter in AccountController:viewAction

This topic contains 6 replies, has 2 voices, and was last updated by  Rodolfo 8 years, 5 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #28587

    Rodolfo
    Participant

    Hi there,

    I need to add some extra information HERE

    I could override the whole twig page from my bundle, but I noticed that MagentoBundle does a trick using Listeners to add MagentoOrders in the bottom of that page.

    If I understood well, this is the Listener: AccountWidgetsDataGridListener.php

    And this is the service registering it.

    My questions are:

    1) Where is locate the event dispatcher for that listener?

    2) Where can I define that this listener should override that specific block in that twig?

    3) Using onBuildAfter() it’s possible to change a datagrid, but how can I change a simple html block adding an extra information there?

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #28588

    Yurii Muratov
    Participant

    Hi, @rbandeira.

    At the account page, additional info goes from placeholders, not from the AccountWidgetsDataGridListener.php.
    This template have placeholders definitioins.
    In case of Magento channel, this placeholder will have orocrm_account_channel_info_magento name. At magento bundle we have this placeholder definition.
    This placeholder renders output of OroCRMMagentoBundle:Customer:accountCustomersInfo action. This template renders tabs from OroCRMMagentoBundle:Customer:accountCustomersInfo action output.
    And the customerInfo.html.twig template of this action renders grid with orders.

    In your case, I would propose to use view_content_data_additional_information placeholder of the root view.html.twig template.
    This placeholder have current entity as parameter, so you can easy check, do your data needs to be rendered on the current view page or not.
    Usage of this placeholder you can see here.
    As you can see, this placeholder’s definition have an orocrm_user_cases_grid item. This item will be rendered only if current entity object InstanceOf user entity.
    And the output of this placeholder’s item (grid with cases) you can find at user’s view page, at Additional Information block http://demo.orocrm.com/desktop/user/profile/view.

    #28589

    Rodolfo
    Participant

    @yurio, man.. I have no words to explain to you how much this information was useful. Thanks so much!!!

    #28590

    Rodolfo
    Participant

    Hi @yurio,

    If I understood well, if I use “view_content_data_additional_information” it will try to render in every view.html.twig.

    How can I add it to rendering only in specific views?
    For example: I want to add an addition information on Accounts/view and another addition information on SalesFunnel/view

    Thank you

    #28591

    Yurii Muratov
    Participant

    Hi, @rbandeira.

    In this case you should create 2 placeholder items:

    your placeholders.yml file will looks like:

    As you can see, at items whereis check on needed entity type at “applicable: @oro_ui.placeholder.filter->isInstanceOf($entity$, “OroCRM\Bundle\AccountBundle\Entity\Account”)” line.

    #28592

    Yurii Muratov
    Participant

    Small fix – classnames should not go with quotes.

    The right code will be:


    placeholders:
    view_content_data_additional_information:
    items:
    accounts_additional_indormation: ~
    salesfunnel_additional_indormation: ~
    items:
    accounts_additional_indormation:
    template: path_to_your_template.html.twig
    applicable: @oro_ui.placeholder.filter->isInstanceOf($entity$, OroCRM\Bundle\AccountBundle\Entity\Account)
    salesfunnel_additional_indormation:
    template: path_to_your_template.html.twig
    applicable: @oro_ui.placeholder.filter->isInstanceOf($entity$, OroCRM\Bundle\SalesBundle\Entity\SalesFunnel)

    #28593

    Rodolfo
    Participant

    Thank you so much @yurio !

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

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top