* '#cache' => [
* 'keys' => ['entity_view', 'node', $node->id()],
* 'contexts' => ['languages'],
- * 'tags' => ['node:' . $node->id()],
+ * 'tags' => $node->getCacheTags(),
* 'max-age' => Cache::PERMANENT,
* ],
* @endcode
* 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
function hook_theme_suggestions_HOOK(array $variables) {
$suggestions = [];
- $suggestions[] = 'node__' . $variables['elements']['#langcode'];
+ $suggestions[] = 'hookname__' . $variables['elements']['#langcode'];
return $suggestions;
}
* 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
/**
* 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()
/**
* 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'.