Commit 16883210 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2342683 by David Hernández, dawehner: Fixed NodeViewBuilder should use...

Issue #2342683 by David Hernández, dawehner: Fixed NodeViewBuilder should use static where possible, subclassing is currently too painful.
parent d96918cc
Loading
Loading
Loading
Loading
+3 −3
Changes for core/modules/node/src/NodeViewBuilder.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
      $display = $displays[$bundle];

      if ($display->getComponent('links')) {
        $callback = '\Drupal\node\NodeViewBuilder::renderLinks';
        $callback = get_called_class() . '::renderLinks';
        $context = array(
          'node_entity_id' => $entity->id(),
          'view_mode' => $view_mode,
@@ -98,7 +98,7 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langco
   *   A renderable array representing the node links.
   */
  public static function renderLinks(array $element, array $context) {
    $callback = '\Drupal\node\NodeViewBuilder::renderLinks';
    $callback = get_called_class() . '::renderLinks';
    $placeholder = drupal_render_cache_generate_placeholder($callback, $context);

    $links = array(
@@ -109,7 +109,7 @@ public static function renderLinks(array $element, array $context) {

    if (!$context['in_preview']) {
      $entity = entity_load('node', $context['node_entity_id'])->getTranslation($context['langcode']);
      $links['node'] = self::buildLinks($entity, $context['view_mode']);
      $links['node'] = static::buildLinks($entity, $context['view_mode']);

      // Allow other modules to alter the node links.
      $hook_context = array(