Commit 334b3d7f authored by jhodgdon's avatar jhodgdon
Browse files

Issue #1811520 by JacobSanford, lirantal: Add section tags to theme,...

Issue #1811520 by JacobSanford, lirantal: Add section tags to theme, hook_menu, and t documentation.
parent 15f64cd2
......@@ -1342,6 +1342,7 @@ function bootstrap_hooks() {
* more information, including recommendations on how to break up or not
* break up strings for translation.
* @section sec_translating_vars Translating Variables
* You should never use t() to translate variables, such as calling
* @code t($text); @endcode, unless the text that the variable holds has been
* passed through t() elsewhere (e.g., $text is one of several translated
......@@ -1361,6 +1362,7 @@ function bootstrap_hooks() {
* Translators can then rearrange the string as necessary for the language
* (e.g., in Spanish, it might be "blog de @name").
* @section sec_alt_funcs_install Use During Installation Phase
* During the Drupal installation phase, some resources used by t() wil not be
* available to code that needs localization. See st() and get_t() for
* alternatives.
......@@ -808,6 +808,7 @@ function drupal_find_base_themes($themes, $key, $used_keys = array()) {
* @link themeable theme function or template @endlink, by checking the theme
* registry.
* @section sec_theme_hooks Theme Hooks
* Most commonly, the first argument to this function is the name of the theme
* hook. For instance, to theme a taxonomy term, the theme hook name is
* 'taxonomy_term'. Modules register theme hooks within a hook_theme()
......@@ -819,6 +820,7 @@ function drupal_find_base_themes($themes, $key, $used_keys = array()) {
* underscores changed to hyphens, so for the 'taxonomy_term' theme hook, the
* default template is 'taxonomy-term.tpl.php'.
* @subsection sub_overriding_theme_hooks Overriding Theme Hooks
* Themes may also register new theme hooks within a hook_theme()
* implementation, but it is more common for themes to override default
* implementations provided by modules than to register entirely new theme
......@@ -831,6 +833,7 @@ function drupal_find_base_themes($themes, $key, $used_keys = array()) {
* engine, it overrides the default implementation of the 'page' theme hook by
* containing a 'page.html.twig' file within its folder structure).
* @subsection sub_preprocess_templates Preprocessing for Template Files
* If the implementation is a template file, several functions are called
* before the template file is invoked, to modify the $variables array. These
* fall into the "preprocessing" phase and the "processing" phase, and are
......@@ -879,12 +882,14 @@ function drupal_find_base_themes($themes, $key, $used_keys = array()) {
* - THEME_process_HOOK(&$variables): Allows the theme to process the
* variables specific to the theme hook.
* @subsection sub_preprocess_theme_funcs Preprocessing for Theme Functions
* If the implementation is a function, only the theme-hook-specific preprocess
* and process functions (the ones ending in _HOOK) are called from the
* list above. This is because theme hooks with function implementations
* need to be fast, and calling the non-theme-hook-specific preprocess and
* process functions for them would incur a noticeable performance penalty.
* @subsection sub_alternate_suggestions Suggesting Alternate Hooks
* There are two special variables that these preprocess and process functions
* can set: 'theme_hook_suggestion' and 'theme_hook_suggestions'. These will be
* merged together to form a list of 'suggested' alternate theme hooks to use,
......@@ -554,6 +554,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* paths and whose values are an associative array of properties for each
* path. (The complete list of properties is in the return value section below.)
* @section sec_callback_funcs Callback Functions
* The definition for each path may include a page callback function, which is
* invoked when the registered path is requested. If there is no other
* registered path that fits the requested path better, any further path
......@@ -578,6 +579,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* $jkl will be 'foo'. Note that this automatic passing of optional path
* arguments applies only to page and theme callback functions.
* @subsection sub_callback_arguments Callback Arguments
* In addition to optional path arguments, the page callback and other callback
* functions may specify argument lists as arrays. These argument lists may
* contain both fixed/hard-coded argument values and integers that correspond
......@@ -620,6 +622,8 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* @endcode
* See @link form_api Form API documentation @endlink for details.
* @section sec_path_wildcards Wildcards in Paths
* @subsection sub_simple_wildcards Simple Wildcards
* Wildcards within paths also work with integer substitution. For example,
* your module could register path 'my-module/%/edit':
* @code
......@@ -632,6 +636,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* with 'foo' and passed to the callback function. Note that wildcards may not
* be used as the first component.
* @subsection sub_autoload_wildcards Auto-Loader Wildcards
* Registered paths may also contain special "auto-loader" wildcard components
* in the form of '%mymodule_abc', where the '%' part means that this path
* component is a wildcard, and the 'mymodule_abc' part defines the prefix for a
......@@ -663,6 +668,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* return FALSE for the path 'node/999/edit' if a node with a node ID of 999
* does not exist. The menu routing system will return a 404 error in this case.
* @subsection sub_argument_wildcards Argument Wildcards
* You can also define a %wildcard_to_arg() function (for the example menu
* entry above this would be 'mymodule_abc_to_arg()'). The _to_arg() function
* is invoked to retrieve a value that is used in the path in place of the
......@@ -687,6 +693,7 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* are called when the menu system is generating links to related paths, such
* as the tabs for a set of MENU_LOCAL_TASK items.
* @section sec_render_tabs Rendering Menu Items As Tabs
* You can also make groups of menu items to be rendered (by default) as tabs
* on a page. To do that, first create one menu item of type MENU_NORMAL_ITEM,
* with your chosen path, such as 'foo'. Then duplicate that menu item, using a
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