drupal_render is not executed

JOSE MANUEL VELASCO <[email protected]> Fri, 24 Oct 2014 13:11:57 +0000
Newsgroups gmane.comp.php.drupal.devel
Message-ID <[email protected]>
Hello,

I have a similar issue asked here:=20
http://stackoverflow.com/questions/2409406/call-to-drupal-render-returns-nu=
ll

but on my case, I think the function is not called since if I put a file_pu=
t_contents before the access check, then nothing is written to that temp-fi=
le.=20

Before call the drupal_render function I check the element passed is well-f=
ormed, and apparently it is.
#foo_site_theme.inc
function theme_citroen_site_entity($variables) {
    file_put_contents("/tmp/community.log", "\nSTART\n");
    file_put_contents("/tmp/community.log", print_r($variables['element'], =
true), FILE_APPEND);
   return drupal_render($variables['element']);
}

#common.inc
function drupal_render(&$elements) {
    file_put_contents("/tmp/community.log", "\nhola caracola\n", FILE_APPEN=
D);
    // Early-return nothing if user does not have access.
    if (empty($elements) || (isset($elements['#access']) && !$elements['#ac=
cess'])) {
        return '';
    }

...
...
...
}

So, even if my problem could be about the access permission, I wonder I mig=
ht see the string "hola caracola" at this temp-log-file.

The only conclusion I can get is the function drupal_render is never called=
, what surprises me and I can't understand why.

Also I tried to put a syntax  error inside drupal_render function, and drup=
al works without errors.
If I put the same typo inside theme_citroen_site_entity function, then I ca=
n see this typo-error

Anybody could point me to the right direction?

Thanks in advance.