1

The documentation mentions the sort order is always from lowest to highest, except when around plugins are used, then

The around plugin’s method affects the flow of all plugins that are executed after it.

Affects them how? If you have multiple plugins and all of them include around plugins, the order of execution is in fact from highest to lowest for the after plugins. I did an example similar to the ones in the documentation, with a callable included:

PLUGIN1 PLUGIN2 PLUGIN3 PLUGIN4 PLUGIN5 PLUGIN6
sortOrder 10 20 30 40 50 60
before beforeDispatch() beforeDispatch() beforeDispatch() beforeDispatch() beforeDispatch() beforeDispatch()
around aroundDispatch() aroundDispatch() aroundDispatch()
after afterDispatch() afterDispatch() afterDispatch() afterDispatch() afterDispatch() afterDispatch()

Where the execution is: before 122345566 => callback => after 665345212. I'm curious about the 665345 part. It seems that after plugins are executed from highest to lowest if there is also an around plugin, otherwise lowest to highest. Could you explain this behaviour?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.