Commit e1ab1133 authored by catch's avatar catch
Browse files

Issue #2794261 by longwave, andypost, Oleksiy, Mile23, pguillard, sorlov,...

Issue #2794261 by longwave, andypost, Oleksiy, Mile23, pguillard, sorlov, voleger, jurgenhaas, Chi, borisson_, paulocs, Wim Leers, Berdir: Deprecate render() function in common.inc
parent f563f961
Loading
Loading
Loading
Loading
+5
Changes for core/includes/common.inc: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -382,11 +382,16 @@ function drupal_attach_tabledrag(&$element, array $options) {
 * @return
 *   The rendered element.
 *
 * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
 *   \Drupal\Core\Render\RendererInterface::render() instead.
 *
 * @see https://www.drupal.org/node/2939099
 * @see \Drupal\Core\Render\RendererInterface
 * @see show()
 * @see hide()
 */
function render(&$element) {
  @trigger_error('The render() function is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Render\RendererInterface::render() instead. See https://www.drupal.org/node/2939099', E_USER_DEPRECATED);
  if (!$element && $element !== 0) {
    return NULL;
  }
+10 −14
Changes for core/modules/file/file.field.inc: 10 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -70,28 +70,24 @@ function template_preprocess_file_widget_multiple(&$variables) {
      hide($widget['display']);
    }
    hide($widget['_weight']);
    $widget['_weight']['#attributes']['class'] = [$weight_class];

    // Render everything else together in a column, without the normal wrappers.
    $row = [];
    $widget['#theme_wrappers'] = [];
    $information = \Drupal::service('renderer')->render($widget);
    $display = '';
    $row[] = \Drupal::service('renderer')->render($widget);

    // Arrange the row with the rest of the rendered columns.
    if ($element['#display_field']) {
      unset($widget['display']['#title']);
      $display = [
        'data' => render($widget['display']),
      $row[] = [
        'data' => $widget['display'],
        'class' => ['checkbox'],
      ];
    }
    $widget['_weight']['#attributes']['class'] = [$weight_class];
    $weight = render($widget['_weight']);

    // Arrange the row with all of the rendered columns.
    $row = [];
    $row[] = $information;
    if ($element['#display_field']) {
      $row[] = $display;
    }
    $row[] = $weight;
    $row[] = [
      'data' => $widget['_weight'],
    ];

    // Show the buttons that had previously been marked as hidden in this
    // preprocess function. We use show() to undo the earlier hide().
+5 −3
Changes for core/modules/shortcut/shortcut.module: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -256,11 +256,13 @@ function shortcut_preprocess_page_title(&$variables) {

    // Replicate template_preprocess_html()'s processing to get the title in
    // string form, so we can set the default name for the shortcut.
    // Strip HTML tags from the title.
    $name = trim(strip_tags(render($variables['title'])));
    $name = $variables['title'];
    if (is_array($name)) {
      $name = \Drupal::service('renderer')->render($name);
    }
    $query = [
      'link' => $link,
      'name' => $name,
      'name' => trim(strip_tags($name)),
    ];

    $shortcut_set = shortcut_current_displayed_set();
+5
Changes for core/modules/system/tests/modules/render_deprecation/render_deprecation.info.yml: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
name: 'Use render() and check its deprecation'
type: module
description: 'Use render() and check its deprecation.'
package: Testing
version: VERSION
+12
Changes for core/modules/system/tests/modules/render_deprecation/render_deprecation.routing.yml: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
render_deprecation.function:
  path: '/render_deprecation/function'
  defaults:
    _controller: 'Drupal\render_deprecation\RenderDeprecationController::buildRenderFunction'
  requirements:
    _access: 'TRUE'
render_deprecation.service:
  path: '/render_deprecation/service'
  defaults:
    _controller: 'Drupal\render_deprecation\RenderDeprecationController::buildRenderService'
  requirements:
    _access: 'TRUE'
Loading