Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292900

The documentation for theme() should be clearer about saying not to call it directly.

$
0
0

As per #2006152: [meta] Don't call theme() directly anywhere outside drupal_render(), apparently since D7 was launched we're supposed to be calling drupal_render() exclusively and not call theme() directly.

The current docs for theme() https://api.drupal.org/api/drupal/core%21includes%21theme.inc/function/t... say this:

All requests for themed output must go through this function. It examines the request and routes it to the appropriate theme function or template, by checking the theme registry.

While this is technically true, it is confusingly worded. While all themed output must go through this function, the preferred way to ensure the themed output goes through this function is to build a render array with a #theme key set and then pass that array to drupal_render().


Viewing all articles
Browse latest Browse all 292900

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>