Hi,

So subject is the question.

I have custom theme. There are two two hooks there (in mytheme.theme):

mytheme_preprocess_html() and mytheme_preprocess_node().

When I set $settings['cache']['bins']['render'] = 'cache.backend.null' - both hooks are working.

When I remove this setting - mytheme_preprocess_html() continues to work fine everytime, but mytheme_preprocess_node() works only one time on page reload after clearing cache.

Is it normal or how to get all hooks working all the time regardless of cache setting?

Comments

Roman-K’s picture

So no one knows? How do your hooks work then?

I've managed to put preprocessing node from theme to a module and I am having the same issue: preprocessing is fired just one time after cache cleared.

Wth?

Please, help me figure this out.

Roman-K’s picture

For anyone who will dig this trash in a future.

function mymegamodule_preprocess_node__mymegacontenttype(&$variables) {
    $variables['#cache']['max-age'] = 0;
}

This disables hook caching.

Also notice double underscore in function name. No one states that such syntax should be used for this piece to work.

capynet’s picture

Thanks, I suspected something similar and I confirmed it with your code.

winkflo’s picture

Thanks, your solution works for me too. I love Drupal, but sometimes it makes me really mad.