From a47230585e4d10b70f98a8a1b9c73c9de2fb1be2 Mon Sep 17 00:00:00 2001 From: Florent Torregrosa Date: Sat, 9 May 2015 14:04:04 +0200 Subject: [PATCH] Issue #2479177: Use function element_children to remove $node->content children. --- protected_node.module | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/protected_node.module b/protected_node.module index 629813f..c5dc7d2 100644 --- a/protected_node.module +++ b/protected_node.module @@ -663,12 +663,10 @@ function protected_node_protected_node_hide(&$node) { } $node->teaser = ''; $node->body = ''; - // Does not remove the keys starting with '#' as they usually contain - // information for other modules. - foreach ($node->content as $content_key => $content) { - if (substr($content_key, 0, 1) !== "#") { - unset($node->content[$content_key]); - } + // Remove $node->content children. + $content_children = element_children($node->content); + foreach ($content_children as $content_key) { + unset($node->content[$content_key]); } } -- 2.1.4