Last active
December 28, 2017 09:57
-
-
Save szeidler/2a7fb3e127ed9b28772206345fc3aa95 to your computer and use it in GitHub Desktop.
Show JSON API representation of node only on default and full view mode
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/modules/contenta_enhancements/contenta_enhancements.module b/modules/contenta_enhancements/contenta_enhancements.module | |
index d1b9951..8f0364b 100644 | |
--- a/modules/contenta_enhancements/contenta_enhancements.module | |
+++ b/modules/contenta_enhancements/contenta_enhancements.module | |
@@ -362,7 +362,7 @@ function contenta_enhancements_toolbar_alter(&$items) { | |
function contenta_enhancements_node_view_alter(array &$build, NodeInterface $entity, EntityViewDisplayInterface $display) { | |
// Make sure the help pages are left alone. | |
// TODO: Use the concept of view modes to solve this problem, not this hack. | |
- if ($entity->bundle() === 'page') { | |
+ if ($entity->bundle() === 'page' || ($display->getMode() !== 'default' && $display->getMode() !== 'full')) { | |
return; | |
} | |
// Retrieve JSON API representation of this node. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment