X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FRender%2Ftheme.api.php;h=2bb2eb9aa8fd9615335c14d037d4c01461321a2c;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=6e78d527a7f0fae8669321b04a03459773bc1198;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Render/theme.api.php b/web/core/lib/Drupal/Core/Render/theme.api.php index 6e78d527a..2bb2eb9aa 100644 --- a/web/core/lib/Drupal/Core/Render/theme.api.php +++ b/web/core/lib/Drupal/Core/Render/theme.api.php @@ -364,7 +364,7 @@ * '#cache' => [ * 'keys' => ['entity_view', 'node', $node->id()], * 'contexts' => ['languages'], - * 'tags' => ['node:' . $node->id()], + * 'tags' => $node->getCacheTags(), * 'max-age' => Cache::PERMANENT, * ], * @endcode @@ -613,6 +613,10 @@ function hook_preprocess_HOOK(&$variables) { * hook called (in this case 'node__article') is available in * $variables['theme_hook_original']. * + * Implementations of this hook must be placed in *.module or *.theme files, or + * must otherwise make sure that the hook implementation is available at + * any given time. + * * @todo Add @code sample. * * @param array $variables @@ -627,7 +631,7 @@ function hook_preprocess_HOOK(&$variables) { function hook_theme_suggestions_HOOK(array $variables) { $suggestions = []; - $suggestions[] = 'node__' . $variables['elements']['#langcode']; + $suggestions[] = 'hookname__' . $variables['elements']['#langcode']; return $suggestions; } @@ -694,6 +698,10 @@ function hook_theme_suggestions_alter(array &$suggestions, array $variables, $ho * hook called (in this case 'node__article') is available in * $variables['theme_hook_original']. * + * Implementations of this hook must be placed in *.module or *.theme files, or + * must otherwise make sure that the hook implementation is available at + * any given time. + * * @todo Add @code sample. * * @param array $suggestions @@ -728,7 +736,7 @@ function hook_themes_installed($theme_list) { /** * Respond to themes being uninstalled. * - * @param array $theme_list + * @param array $themes * Array containing the names of the themes being uninstalled. * * @see \Drupal\Core\Extension\ThemeHandler::uninstall() @@ -757,6 +765,12 @@ function hook_extension() { /** * Render a template using the theme engine. * + * It is the theme engine's responsibility to escape variables. The only + * exception is if a variable implements + * \Drupal\Component\Render\MarkupInterface. Drupal is inherently unsafe if + * other variables are not escaped. The helper function + * theme_render_and_autoescape() may be used for this. + * * @param string $template_file * The path (relative to the Drupal root directory) to the template to be * rendered including its extension in the format 'path/to/TEMPLATE_NAME.EXT'.