Magento Request - Frontend or Backend?

后端 未结 5 1937
臣服心动
臣服心动 2020-12-29 05:31

How can I tell if the current request is for a backend or frontend page? This check will be done inside an observer, so I do have access to the request object if that helps

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 05:49

    Whether I'm wrong or not (but I've tested it), some events (like controller_front_init_before) can only be overwritten inside global node. As a result, this override will affect both frontend and backend.

    Then come Alan's and benmark's solution to the rescue to specify if you want to apply the observer on frontend only or backend only.

提交回复
热议问题