Discussion:
drupal_render is not executed
(too old to reply)
JOSE MANUEL VELASCO
2014-10-24 13:11:57 UTC
Permalink
Hello,

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

but on my case, I think the function is not called since if I put a file_put_contents before the access check, then nothing is written to that temp-file.

Before call the drupal_render function I check the element passed is well-formed, 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_APPEND);
// Early-return nothing if user does not have access.
if (empty($elements) || (isset($elements['#access']) && !$elements['#access'])) {
return '';
}

...
...
...
}

So, even if my problem could be about the access permission, I wonder I might 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 drupal works without errors.
If I put the same typo inside theme_citroen_site_entity function, then I can see this typo-error

Anybody could point me to the right direction?

Thanks in advance.

Loading...