0

I have a Drupal 7 theme which is a Bootstrap child theme.

In my version of page.vars.php, I have a THEME_page_alter() call which runs only once until I do a clear cache. Other hooks such as THEME_process_page or THEME_preprocess_page are called each time I reload the page.

A second theme, with the same page_alter hook works just fine and is called each page-reload without the need for a clear-cache first.

What could be causing this?

5
  • Are the 2 themes tested on the same site?
    – Jimmy Ko
    Commented Dec 19, 2016 at 14:44
  • Yes, they are on a multi-domain setup, but all running from the same Drupal instance. Commented Dec 19, 2016 at 15:20
  • I suspect it is due to the page cache...
    – Jimmy Ko
    Commented Dec 19, 2016 at 16:21
  • Why would the output change though? Surely it would cache the same result as the first run? Commented Dec 19, 2016 at 16:43
  • As I remember, rendering array is cached if you enable page cache. But preprocess function still work because the cache is made before the preprocess function.
    – Jimmy Ko
    Commented Dec 19, 2016 at 17:17

1 Answer 1

0

Theme settings are specific to each theme. Go to /admin/appearance/settings/yourtheme and check for any theme-specific caching options. I can't tell you exactly what the options would be because that depends on your theme.

1
  • I couldn't see anything of relevance in there. The thing is that the logic that runs the first time around in THEME_page_alter() works correctly, but then it's not like it caches the correct logic on the subsequent page load. It seems to not run at all, and displays a region that I specifically want to hide (unset) Commented Dec 19, 2016 at 15:23

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.