Created
March 29, 2018 08:13
-
-
Save filiphazardous/af56100a74e88839a35e0f6b6ba5c424 to your computer and use it in GitHub Desktop.
Add nodes in block to context for viewsreference v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru a/viewsreference/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php b/viewsreference/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php | |
--- a/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php | |
+++ b/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php | |
@@ -100,6 +100,9 @@ | |
} | |
$node = \Drupal::routeMatch()->getParameter('node'); | |
+ if ($items->getEntity() instanceof \Drupal\node\NodeInterface) { | |
+ $node = $items->getEntity(); | |
+ } | |
$token_service = \Drupal::token(); | |
if (is_array($arguments)) { | |
foreach ($arguments as $index => $argument) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment