Commit 16883210 authored by alexpott's avatar alexpott

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
...@@ -35,7 +35,7 @@ public function buildComponents(array &$build, array $entities, array $displays, ...@@ -35,7 +35,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
$display = $displays[$bundle]; $display = $displays[$bundle];
if ($display->getComponent('links')) { if ($display->getComponent('links')) {
$callback = '\Drupal\node\NodeViewBuilder::renderLinks'; $callback = get_called_class() . '::renderLinks';
$context = array( $context = array(
'node_entity_id' => $entity->id(), 'node_entity_id' => $entity->id(),
'view_mode' => $view_mode, 'view_mode' => $view_mode,
...@@ -98,7 +98,7 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langco ...@@ -98,7 +98,7 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langco
* A renderable array representing the node links. * A renderable array representing the node links.
*/ */
public static function renderLinks(array $element, array $context) { 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); $placeholder = drupal_render_cache_generate_placeholder($callback, $context);
$links = array( $links = array(
...@@ -109,7 +109,7 @@ public static function renderLinks(array $element, array $context) { ...@@ -109,7 +109,7 @@ public static function renderLinks(array $element, array $context) {
if (!$context['in_preview']) { if (!$context['in_preview']) {
$entity = entity_load('node', $context['node_entity_id'])->getTranslation($context['langcode']); $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. // Allow other modules to alter the node links.
$hook_context = array( $hook_context = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment