Last active
March 29, 2018 08:11
-
-
Save filiphazardous/2084576000ec27ae2ffdc2bc4e0739f6 to your computer and use it in GitHub Desktop.
Add nodes in block to context for viewsreference
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 (!$node && $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