[themes] D7 adding a themed item to a region

Carl Wiedemann carl.wiedemann at gmail.com
Mon May 28 17:04:51 UTC 2012


Render arrays are very specific, so you'd likely have to add it via
$page['some_key']['#markup'] => $output;

I'd recommend doing these things in the preprocess function, not the
process function. Preprocess is generally better understood and has more
historic precedence.

Unless you have an explicit reason to use render(), I don't see any harm in
creating your own variables in the preprocessor and printing them directly.

Carl Wiedemann
Website design & development consulting | c4rl.ws
carl.wiedemann at gmail.com | skype: c4rlww



On Mon, May 28, 2012 at 10:46 AM, Jeff Greenberg <
listmail.ayendesigns at gmail.com> wrote:

> I am displaying a large image in a front-page region. Currently I hook
> process_region in template.php, set a variable = theme('image'), and print
> it.
>
> I'm thinking that rather than printing it from the hook, I'd rather add it
> to $page[my_region_name] and let it get printed when the template prints
> render[my_region_name].
>
> Where do I add it, or what do I call to add it?  I tried doing things in
> the hook like $vars[page][my_region_name][content][] = $my_themed_image,
> but that doesn't work.
>
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20120528/7f73bc22/attachment.html 


More information about the themes mailing list