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 Answer 1

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();
    }
}
2
  • 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. Commented Jul 8, 2019 at 7:39
  • No, this is the only way. Once you entered Function you cannot avoid "before".
    – PY Yick
    Commented Jul 8, 2019 at 7:53

Your Answer

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

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