Unverified Commit ace4b281 authored by Alex Pott's avatar Alex Pott
Browse files

docs: #3624887 Remove obsolete hook_extension() and hook_render_template() documentation

By: matthand
By: nicxvan
By: sapnil_biswas
(cherry picked from commit f64947a0)
parent c70c55f5
Loading
Loading
Loading
Loading
Loading
+0 −41
Changes for core/lib/Drupal/Core/Render/theme.api.php: 0 added lines, 41 removed lines.
Original line number Diff line number Diff line
@@ -807,47 +807,6 @@ function hook_themes_uninstalled(array $themes): void {
  }
}

/**
 * Declare a template file extension to be used with a theme engine.
 *
 * This hook is used in a theme engine implementation in the format of
 * ENGINE_extension().
 *
 * @return string
 *   The file extension the theme engine will recognize.
 */
function hook_extension(): string {
  // Extension for template base names in Twig.
  return '.html.twig';
}

/**
 * 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.
 *
 * @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'.
 * @param array $variables
 *   A keyed array of variables that are available for composing the output. The
 *   theme engine is responsible for passing all the variables to the template.
 *   Depending on the code in the template, all or just a subset of the
 *   variables might be used in the template.
 *
 * @return string
 *   The output generated from the template. In most cases this will be a string
 *   containing HTML markup.
 */
function hook_render_template($template_file, $variables): string|\Stringable {
  $twig_service = \Drupal::service('twig');

  return $twig_service->loadTemplate($template_file)->render($variables);
}

/**
 * Alter the element type information returned from modules.
 *