Commit bf36c6cd authored by webchick's avatar webchick
Browse files

Issue #1021568 by skottler, sven.lauer, jhodgdon: Fixed hook_theme() variables vs render elements.

parent 765b9164
...@@ -1561,6 +1561,12 @@ function hook_permission() { ...@@ -1561,6 +1561,12 @@ function hook_permission() {
/** /**
* Register a module (or theme's) theme implementations. * Register a module (or theme's) theme implementations.
* *
* The implementations declared by this hook have two purposes: either they
* specify how a particular render array is to be rendered as HTML (this is
* usually the case if the theme function is assigned to the render array's
* #theme property), or they return the HTML that should be returned by an
* invocation of theme().
*
* The following parameters are all optional. * The following parameters are all optional.
* *
* @param array $existing * @param array $existing
...@@ -1588,21 +1594,26 @@ function hook_permission() { ...@@ -1588,21 +1594,26 @@ function hook_permission() {
* @return array * @return array
* An associative array of theme hook information. The keys on the outer * An associative array of theme hook information. The keys on the outer
* array are the internal names of the hooks, and the values are arrays * array are the internal names of the hooks, and the values are arrays
* containing information about the hook. Each array may contain the * containing information about the hook. Each information array must contain
* following elements: * either a 'variables' element or a 'render element' element, but not both.
* - variables: (required if "render element" not present) An array of * Use 'render element' if you are theming a single element or element tree
* variables that this theme hook uses. This value allows the theme layer * composed of elements, such as a form array, a page array, or a single
* to properly utilize templates. Each array key represents the name of the * checkbox element. Use 'variables' if your theme implementation is
* variable and the value will be used as the default value if it is not * intended to be called directly through theme() and has multiple arguments
* given when theme() is called. Template implementations receive these * for the data and style; in this case, the variables not supplied by the
* arguments as variables in the template file. Function implementations * calling function will be given default values and passed to the template
* are passed this array data in the $variables parameter. * or theme function. The returned theme information array can contain the
* - render element: (required if "variables" not present) A string that is * following key/value pairs:
* the name of the sole renderable element to pass to the theme function. * - variables: (see above) Each array key is the name of the variable, and
* The string represents the name of the "variable" that will hold the * the value given is used as the default value if the function calling
* renderable array inside any optional preprocess or process functions. * theme() does not supply it. Template implementations receive each array
* Cannot be used with the "variables" item; only one or the other, not * key as a variable in the template file (so they must be legal PHP
* both, can be present in a hook's info array. * variable names). Function implementations are passed the variables in a
* single $variables function argument.
* - render element: (see above) The name of the renderable element or element
* tree to pass to the theme function. This name is used as the name of the
* variable that holds the renderable element or tree in preprocess and
* process functions.
* - file: The file the implementation resides in. This file will be included * - file: The file the implementation resides in. This file will be included
* prior to the theme being rendered, to make sure that the function or * prior to the theme being rendered, to make sure that the function or
* preprocess function (as needed) is actually loaded; this makes it * preprocess function (as needed) is actually loaded; this makes it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment