<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hook-Theme on despatches</title><link>https://icle.es/tags/hook-theme/</link><description>Recent content in Hook-Theme on despatches</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 20 Jun 2025 08:42:17 +0100</lastBuildDate><atom:link href="https://icle.es/tags/hook-theme/index.xml" rel="self" type="application/rss+xml"/><item><title>hook_theme doesn't get called</title><link>https://icle.es/2011/02/22/hook_theme-doesnt-get-called/</link><pubDate>Tue, 22 Feb 2011 20:20:11 +0000</pubDate><guid>https://icle.es/2011/02/22/hook_theme-doesnt-get-called/</guid><description>&lt;p>I was developing a new module in drupal and it needed a theme function to be
implemented.&lt;/p>
&lt;p>As per the instructions, it was implemented as follows (to use a template)&lt;/p>
```phg
/**
 * Implementation of hook_theme().
 */
function my_module_results_theme($existing, $type, $theme, $path) {

 return array(
 'my_block' => array(
 'template' => 'my_block',
 'arguments' => array(
 'var1' => NULL
 )
 )
 );
}
```
&lt;p>However, when trying to apply the theme, it didn&amp;rsquo;t work. I tried various things
and identified that the hook above was just not being called. A little bit of
digging helped me discover that themes are cached. This happens even in the dev
mode. To resolve this, go to&lt;/p></description><content:encoded><![CDATA[<p>I was developing a new module in drupal and it needed a theme function to be
implemented.</p>
<p>As per the instructions, it was implemented as follows (to use a template)</p>
```phg
/**
 * Implementation of hook_theme().
 */
function my_module_results_theme($existing, $type, $theme, $path) {

    return array(
        'my_block' => array(
            'template' => 'my_block',
            'arguments' => array(
                'var1' => NULL
            )
        )
    );
}
```
<p>However, when trying to apply the theme, it didn&rsquo;t work. I tried various things
and identified that the hook above was just not being called. A little bit of
digging helped me discover that themes are cached. This happens even in the dev
mode. To resolve this, go to</p>
<p><code>Administer  -&gt; Performance -&gt; Clear Cached Data</code> (right at the bottom of the
page)</p>
<p>and et voila my theme was now being utilised.</p>
]]></content:encoded></item></channel></rss>