-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hook::on in Block with enabled cache #146
Comments
Maybe we can have an event listener which is triggered accordingly (whether its register from cache or not): $this->on(self::EVENT_AFTER_REGISTER, function() { |
@boehsermoe onRegister() and onRegisterFromCache() should trigger an event which blocks can register listeneres while initialize (init() method) (example above) |
Ok I will take a closer look at the next days. |
i think $this->trigger(self::EVENT_ON_REGISTER) should do the job, maybe i will find time next week. |
I think it is a little more difficult. For one the block classes does not have any event handling implemented yet. The other thing is if you override a view from a core block (or other module) you cannot listen on this event without make your own block. It should be able to listen on events via block variants too. What do you think? |
The event handling can be achieved by using Component instead of BaseObject for InternalBaseBlock. I think this is just a more wide used behavior when registering hooks (or other things) inside a block, therefore this event is used. |
If you use the
Hook::on
function in a block with cache enabled it only works once (after cache clear).Currently I invoke the function in the view file, is there a possibility to exclude certain functions in the block from caching?
The text was updated successfully, but these errors were encountered: