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

Issue #2938969 by msankhala, dhirendra.mishra, paulocs, TR, MerryHamster,...

Issue #2938969 by msankhala, dhirendra.mishra, paulocs, TR, MerryHamster, alexpott, jofitz, longwave, Manuel Garcia, tameeshb, boaloysius, Yasiru Nilan, xjm, wturrell, ritzz, ZeiP, darrenwh: Replace drupal_render() in docblock and comments outside of @param, @return, @Link, @see and outside of @code - @endcode

(cherry picked from commit 84fc7490)
parent f7ccf32f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2413,8 +2413,8 @@ function hook_validation_constraint_alter(array &$definitions) {
 * @code
 * array('#type' => 'status_messages')
 * @endcode
 * to a render array, use drupal_render() to render it, and add a command to
 * place the messages in an appropriate location.
 * to a render array, use \Drupal::service('renderer')->render() to render it,
 * and add a command to place the messages in an appropriate location.
 *
 * @section sec_other Other methods for triggering Ajax
 * Here are some additional methods you can use to trigger Ajax responses in
+16 −14
Original line number Diff line number Diff line
@@ -408,13 +408,13 @@ function render(&$element) {
/**
 * Hides an element from later rendering.
 *
 * The first time render() or drupal_render() is called on an element tree,
 * as each element in the tree is rendered, it is marked with a #printed flag
 * and the rendered children of the element are cached. Subsequent calls to
 * render() or drupal_render() will not traverse the child tree of this element
 * again: they will just use the cached children. So if you want to hide an
 * element, be sure to call hide() on the element before its parent tree is
 * rendered for the first time, as it will have no effect on subsequent
 * The first time render() or RenderInterface::render() is called on an element
 * tree, as each element in the tree is rendered, it is marked with a #printed
 * flag and the rendered children of the element are cached. Subsequent calls to
 * render() or RenderInterface::render() will not traverse the child tree of
 * this element again: they will just use the cached children. So if you want to
 * hide an element, be sure to call hide() on the element before its parent tree
 * is rendered for the first time, as it will have no effect on subsequent
 * renderings of the parent tree.
 *
 * @param $element
@@ -423,6 +423,7 @@ function render(&$element) {
 * @return
 *   The element.
 *
 * @see \Drupal\Core\Render\RendererInterface
 * @see render()
 * @see show()
 */
@@ -437,13 +438,13 @@ function hide(&$element) {
 * You can also use render($element), which shows the element while rendering
 * it.
 *
 * The first time render() or drupal_render() is called on an element tree,
 * as each element in the tree is rendered, it is marked with a #printed flag
 * and the rendered children of the element are cached. Subsequent calls to
 * render() or drupal_render() will not traverse the child tree of this element
 * again: they will just use the cached children. So if you want to show an
 * element, be sure to call show() on the element before its parent tree is
 * rendered for the first time, as it will have no effect on subsequent
 * The first time render() or RenderInterface::render() is called on an element
 * tree, as each element in the tree is rendered, it is marked with a #printed
 * flag and the rendered children of the element are cached. Subsequent calls to
 * render() or RenderInterface::render() will not traverse the child tree of
 * this element again: they will just use the cached children. So if you want to
 * show an element, be sure to call show() on the element before its parent tree
 * is rendered for the first time, as it will have no effect on subsequent
 * renderings of the parent tree.
 *
 * @param $element
@@ -452,6 +453,7 @@ function hide(&$element) {
 * @return
 *   The element.
 *
 * @see \Drupal\Core\Render\RendererInterface
 * @see render()
 * @see hide()
 */
+2 −2
Original line number Diff line number Diff line
@@ -246,8 +246,8 @@ public function build(array $build) {
   * This function is assigned as a #pre_render callback in ::viewMultiple().
   *
   * By delaying the building of an entity until the #pre_render processing in
   * drupal_render(), the processing cost of assembling an entity's renderable
   * array is saved on cache-hit requests.
   * \Drupal::service('renderer')->render(), the processing cost of assembling
   * an entity's renderable array is saved on cache-hit requests.
   *
   * @param array $build_list
   *   A renderable  array containing build information and context for an
+4 −4
Original line number Diff line number Diff line
@@ -1537,7 +1537,7 @@ function hook_ENTITY_TYPE_view(array &$build, \Drupal\Core\Entity\EntityInterfac
 * the particular entity type template, if there is one (e.g., node.html.twig).
 *
 * See the @link themeable Default theme implementations topic @endlink and
 * drupal_render() for details.
 * \Drupal\Core\Render\RendererInterface::render() for details.
 *
 * @param array &$build
 *   A renderable array representing the entity content.
@@ -1576,7 +1576,7 @@ function hook_entity_view_alter(array &$build, \Drupal\Core\Entity\EntityInterfa
 * the particular entity type template, if there is one (e.g., node.html.twig).
 *
 * See the @link themeable Default theme implementations topic @endlink and
 * drupal_render() for details.
 * \Drupal\Core\Render\RendererInterface::render() for details.
 *
 * @param array &$build
 *   A renderable array representing the entity content.
@@ -1659,7 +1659,7 @@ function hook_entity_view_mode_alter(&$view_mode, \Drupal\Core\Entity\EntityInte
}

/**
 * Alter entity renderable values before cache checking in drupal_render().
 * Alter entity renderable values before cache checking during rendering.
 *
 * Invoked for a specific entity type.
 *
@@ -1685,7 +1685,7 @@ function hook_ENTITY_TYPE_build_defaults_alter(array &$build, \Drupal\Core\Entit
}

/**
 * Alter entity renderable values before cache checking in drupal_render().
 * Alter entity renderable values before cache checking during rendering.
 *
 * The values in the #cache key of the renderable array are used to determine if
 * a cache entry exists for the entity's rendered output. Ideally only values
+9 −9
Original line number Diff line number Diff line
@@ -17,11 +17,11 @@
/**
 * Subscriber that wraps controllers, to handle early rendering.
 *
 * When controllers call drupal_render() (RendererInterface::render()) outside
 * of a render context, we call that "early rendering". Controllers should
 * return only render arrays, but we cannot prevent controllers from doing early
 * rendering. The problem with early rendering is that the bubbleable metadata
 * (cacheability & attachments) are lost.
 * When controllers call RendererInterface::render() outside of a render
 * context, we call that "early rendering". Controllers should return
 * only render arrays, but we cannot prevent controllers from doing
 * early rendering. The problem with early rendering is that the
 * bubbleable metadata (cacheability & attachments) are lost.
 *
 * This can lead to broken pages (missing assets), stale pages (missing cache
 * tags causing a page not to be invalidated) or even security problems (missing
@@ -36,8 +36,8 @@
 * ::renderPlain() methods. In that case, no bubbleable metadata is lost.
 *
 * If the render context is not empty, then the controller did use
 * drupal_render(), and bubbleable metadata was collected. This bubbleable
 * metadata is then merged onto the render array.
 * RendererInterface::render(), and bubbleable metadata was collected.
 * This bubbleable metadata is then merged onto the render array.
 *
 * In other words: this just exists to ease the transition to Drupal 8: it
 * allows controllers that return render arrays (the majority) and
@@ -124,8 +124,8 @@ protected function wrapControllerExecutionInRenderContext($controller, array $ar
    });

    // If early rendering happened, i.e. if code in the controller called
    // drupal_render() outside of a render context, then the bubbleable metadata
    // for that is stored in the current render context.
    // RendererInterface::render() outside of a render context, then the
    // bubbleable metadata for that is stored in the current render context.
    if (!$context->isEmpty()) {
      /** @var \Drupal\Core\Render\BubbleableMetadata $early_rendering_bubbleable_metadata */
      $early_rendering_bubbleable_metadata = $context->pop();
Loading