-
Notifications
You must be signed in to change notification settings - Fork 40
Open
backdrop/backdrop
#3113Description
Initial PR for this issue: backdrop/backdrop#3113
The documentation we use for preprocess functions is inconsistent all over core. Drupal 8 adopted a new standard. Below are two examples of the documentation I'm proposing for Backdrop.
- When there are only a few variables (5 or fewer) provided to the template we should list them all in the docs for the preprocess function. For example:
/**
* Prepares variables for block templates.
*
* @param $variables
* An array containing (but not limited to) the following:
* - content: The actual content of the block.
* - block: The block object being displayed.
*
* @see block.tpl.php
*/
function template_preprocess_block(&$variables) {
- When there are a lot of variables (6 or more) provided to the template (node, for example) we can point people to the template file where all available default variables should be listed. For example:
/**
* Prepares variables for node templates.
*
* Most themes use their own copy of node.tpl.php. The default is located at
* "core/modules/node/node.tpl.php". The full list of variables is documented
* in that file.
*
* @param $variables
* An array containing, but not imited to, the following:
* - node: Full node entity. Contains data that may not be safe.
* - view_mode: View mode; for example, "full", or "teaser".
*
* @see node.tpl.php
*/
function template_preprocess_node(&$variables) {
Reactions are currently unavailable