2

In around plugin function, if we don't use proceed() then after plugin execution will be suppressed. Is there anyway by which we can suppress before plugin execution?

1

Why not wrap everything inside around plugin for your case? So that:

public function aroundFunction(\My\Module\Model\MyUtility $subject, callable $proceed){
    //If condition is true
    if (true){
        //BeforeFunction
        //Do sonething
        //ExecuteFunction
        $proceed();
    }
}
  • I agree with your solution to add condition to prevent after plugin. Is there anyway by which we can supress before part of around plugin. – Mayur Vijay Kathale Jul 8 at 7:39
  • No, this is the only way. Once you entered Function you cannot avoid "before". – PY Yick Jul 8 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.