Skip to content
Snippets Groups Projects
Commit 9a3cc141 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS_5234: ensuring that media is not saved when none is selected

parent a4b7af95
No related branches found
No related tags found
1 merge request!184Feature/istwcms 5234 ebremner hero
......@@ -136,6 +136,19 @@ function uw_cfg_common_entity_presave(EntityInterface $entity) {
}
}
}
// If there is a type of media, ensure that we do only have
// values in the fields that are selected.
if ($entity->hasField('field_uw_type_of_media')) {
// Get the type of media.
$type_of_media = $entity->field_uw_type_of_media->value;
// If it is null then set the hero image to null.
if ($type_of_media == NULL) {
$entity->set('field_uw_hero_image', NULL);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment