Created
August 23, 2018 09:12
-
-
Save szeidler/aedcf23e11af43f40f4a08466f76b459 to your computer and use it in GitHub Desktop.
Show paragraphs edit contextual links, even when no root parent was found. E.g. when using it with entity_embed
This file contains hidden or 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 --git a/paragraphs_edit.module b/paragraphs_edit.module | |
index e64656d..6aaeedf 100644 | |
--- a/paragraphs_edit.module | |
+++ b/paragraphs_edit.module | |
@@ -54,6 +54,15 @@ function paragraphs_edit_paragraph_view_alter(array &$build, ParagraphInterface | |
'metadata' => ['changed' => $root_parent->getChangedTime()], | |
]; | |
} | |
+ else { | |
+ $build['#contextual_links']['paragraph'] = [ | |
+ 'route_parameters' => [ | |
+ 'root_parent_type' => $entity->getEntityTypeId(), | |
+ 'root_parent' => $entity->id(), | |
+ 'paragraph' => $entity->id(), | |
+ ], | |
+ ]; | |
+ } | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment