From 0a4ad3ade91e3f603d37b979717f84f6ea4d91b9 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Fri, 14 Oct 2022 20:23:25 -0400 Subject: [PATCH] ISTWCMS-5880: fixing banner validation when banners are closed in the node edit --- uw_cfg_common.module | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/uw_cfg_common.module b/uw_cfg_common.module index 68b9e459..f149a9fc 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -1074,8 +1074,12 @@ function _uw_cfg_common_banner_validate(array &$form, FormStateInterface $form_s foreach ($values['field_uw_banner'] as $key => $value) { // Ensure that the key is an integer, since there is an add_more - // in the values. - if (is_int($key)) { + // in the values. We also need to check if there is "top" in the + // array, as this is what paragraphs uses for closed items. These + // closed items have already been validated so if there is a closed + // item we can just ignore it, only open items, meaning it has values + // in the fields needs to be validated. + if (is_int($key) && !$value['top']) { // If there is no selection on the media, then there is no image, // so set the error. -- GitLab