Skip to content
Snippets Groups Projects

ISTWCMS-7141: fix adding media to banners

@@ -170,13 +170,39 @@ function _uw_cfg_common_banner_validate(
}
else {
// If there is a banner, ensure that it has an image.
// If there is a banner, ensure that it has an image or video.
if (isset($value['subform'])) {
if (!isset($value['subform']['field_uw_ban_image']['selection'])) {
$form_state->setError(
$form['field_uw_banner']['widget'][$key]['subform']['field_uw_ban_image']['widget'],
t("You must select an image")
);
if (isset($value['subform']['field_uw_ban_video'])) {
if (!isset($value['subform']['field_uw_ban_video']['selection'])) {
if (isset($form['settings'])) {
$form_state->setError(
$form['settings']['block_form']['field_uw_banner_item']['widget'][$key]['subform']['field_uw_ban_video']['widget'],
t("You must select a video")
);
}
else {
$form_state->setError(
$form['field_uw_banner']['widget'][$key]['subform']['field_uw_ban_video']['widget'],
t("You must select a video")
);
}
}
}
if (isset($value['subform']['field_uw_ban_image'])) {
if (!isset($value['subform']['field_uw_ban_image']['selection'])) {
if (isset($form['settings'])) {
$form_state->setError(
$form['settings']['block_form']['field_uw_banner_item']['widget'][$key]['subform']['field_uw_ban_image']['widget'],
t("You must select an image")
);
}
else {
$form_state->setError(
$form['field_uw_banner']['widget'][$key]['subform']['field_uw_ban_image']['widget'],
t("You must select an image")
);
}
}
}
}
}
Loading