Loading core/lib/Drupal/Core/Render/Renderer.php +6 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,12 @@ public function renderPlaceholder($placeholder, array $elements) { /** * {@inheritdoc} */ public function render(&$elements, $is_root_call = FALSE) { public function render(/* array */&$elements, $is_root_call = FALSE) { if (!is_array($elements)) { return ''; } $context = $this->getCurrentRenderContext(); if (!isset($context)) { throw new \LogicException("Render context is empty, because render() was called outside of a renderRoot() or renderPlain() call. Use renderPlain()/renderRoot() or #lazy_builder/#pre_render instead."); Loading core/lib/Drupal/Core/Render/RendererInterface.php +1 −1 Original line number Diff line number Diff line Loading @@ -340,7 +340,7 @@ public function renderPlaceholder($placeholder, array $elements); * @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments() * @see \Drupal\Core\Render\RendererInterface::renderRoot() */ public function render(&$elements, $is_root_call = FALSE); public function render(/* array */&$elements, $is_root_call = FALSE); /** * Checks whether a render context is active. Loading core/modules/node/node.module +5 −4 Original line number Diff line number Diff line Loading @@ -325,10 +325,11 @@ function template_preprocess_node(&$variables): void { // $variables['content'] is more flexible and consistent. $submitted_configurable = $node->getFieldDefinition('created')->isDisplayConfigurable('view') || $node->getFieldDefinition('uid')->isDisplayConfigurable('view'); if (!$skip_custom_preprocessing || !$submitted_configurable) { $variables['date'] = \Drupal::service('renderer')->render($variables['elements']['created']); unset($variables['elements']['created']); $variables['author_name'] = \Drupal::service('renderer')->render($variables['elements']['uid']); unset($variables['elements']['uid']); /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = \Drupal::service('renderer'); $variables['date'] = !empty($variables['elements']['created']) ? $renderer->render($variables['elements']['created']) : ''; $variables['author_name'] = !empty($variables['elements']['uid']) ? $renderer->render($variables['elements']['uid']) : ''; unset($variables['elements']['created'], $variables['elements']['uid']); } if (isset($variables['elements']['title']) && (!$skip_custom_preprocessing || !$node->getFieldDefinition('title')->isDisplayConfigurable('view'))) { Loading Loading
core/lib/Drupal/Core/Render/Renderer.php +6 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,12 @@ public function renderPlaceholder($placeholder, array $elements) { /** * {@inheritdoc} */ public function render(&$elements, $is_root_call = FALSE) { public function render(/* array */&$elements, $is_root_call = FALSE) { if (!is_array($elements)) { return ''; } $context = $this->getCurrentRenderContext(); if (!isset($context)) { throw new \LogicException("Render context is empty, because render() was called outside of a renderRoot() or renderPlain() call. Use renderPlain()/renderRoot() or #lazy_builder/#pre_render instead."); Loading
core/lib/Drupal/Core/Render/RendererInterface.php +1 −1 Original line number Diff line number Diff line Loading @@ -340,7 +340,7 @@ public function renderPlaceholder($placeholder, array $elements); * @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments() * @see \Drupal\Core\Render\RendererInterface::renderRoot() */ public function render(&$elements, $is_root_call = FALSE); public function render(/* array */&$elements, $is_root_call = FALSE); /** * Checks whether a render context is active. Loading
core/modules/node/node.module +5 −4 Original line number Diff line number Diff line Loading @@ -325,10 +325,11 @@ function template_preprocess_node(&$variables): void { // $variables['content'] is more flexible and consistent. $submitted_configurable = $node->getFieldDefinition('created')->isDisplayConfigurable('view') || $node->getFieldDefinition('uid')->isDisplayConfigurable('view'); if (!$skip_custom_preprocessing || !$submitted_configurable) { $variables['date'] = \Drupal::service('renderer')->render($variables['elements']['created']); unset($variables['elements']['created']); $variables['author_name'] = \Drupal::service('renderer')->render($variables['elements']['uid']); unset($variables['elements']['uid']); /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = \Drupal::service('renderer'); $variables['date'] = !empty($variables['elements']['created']) ? $renderer->render($variables['elements']['created']) : ''; $variables['author_name'] = !empty($variables['elements']['uid']) ? $renderer->render($variables['elements']['uid']) : ''; unset($variables['elements']['created'], $variables['elements']['uid']); } if (isset($variables['elements']['title']) && (!$skip_custom_preprocessing || !$node->getFieldDefinition('title')->isDisplayConfigurable('view'))) { Loading