From 25a91411ecd4a8eaf5e1feb969a30825ae8fe39e Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 22 Jan 2024 14:08:45 +0100 Subject: [PATCH] [DS-1023] Fix the function that skips attaching WS libraries for pages without LB . --- .../modules/ws_home_branch/ws_home_branch.module | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openy_home_branch/modules/ws_home_branch/ws_home_branch.module b/openy_home_branch/modules/ws_home_branch/ws_home_branch.module index b68dd59b..43ffe7c4 100644 --- a/openy_home_branch/modules/ws_home_branch/ws_home_branch.module +++ b/openy_home_branch/modules/ws_home_branch/ws_home_branch.module @@ -52,9 +52,16 @@ function ws_home_branch_preprocess_block__lb_openy_map(&$variables) { function _ws_home_branch_skip_override($node) { // Skip page without node. + if (!$node instanceof NodeInterface) { + return TRUE; + } // Skip nodes without LB usage. + if (!$node->hasField('layout_builder__layout')) { + return TRUE; + } // Skip nodes with optional layout builder usage with deactivated usage. - if (!$node instanceof NodeInterface || !$node->hasField('layout_builder__layout') && $node->hasField('field_use_layout_builder') && !$node->field_use_layout_builder->value) { + if ($node->hasField('field_use_layout_builder') + && !$node->field_use_layout_builder->value) { return TRUE; } return FALSE;