OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce How to restrict a custom action to a specific screen?

This topic contains 4 replies, has 2 voices, and was last updated by  Mauro Chojrin 1 year, 4 months ago.

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

  • Creator
  • #38639

    Mauro Chojrin


    I created a custom action for the order entity (More on that here).

    I got it working allright (functionality wise) but I’m having a little but annoying issue: the button is showing in every screen where an order is involved, and I just want it to be shown when showing a particular order (In a URL like /admin/order/view/8).

    My configuration file looks like this:


Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #38663
    Andrey Yatsenko
    Andrey Yatsenko

    You can use preactions and preconditions to control when to display the button.
    Here is an example: https://github.com/oroinc/platform/blob/master/src/Oro/Bundle/TranslationBundle/Resources/config/oro/actions.yml#L242-L251


    Mauro Chojrin

    Thanks Andrey! You’re very helpful as usual :)

    I have one question though… I’m a little confused about the purpose of the routes setting… I was under the impression this was the list of routes in which the action should be shown… is this not the case?

    Andrey Yatsenko
    Andrey Yatsenko

    It doesn’t work as you expected because both configs are specified, “entities” and “routes”.

    Try to remove entities:
    As the route oro_order_view is used only for an order entity, you will have the expected result.

    These conditions work as OR, not AND.
    So when the route is one of “routes” OR entity is one of “entities” the action will be shown.

    • This reply was modified 1 year, 4 months ago by Andrey Yatsenko Andrey Yatsenko. Reason: Clarified the issue cause

    Mauro Chojrin

    Got it! Thanks!

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

The forum ‘OroCommerce’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No