Skip to content
Snippets Groups Projects
Commit bcf68b9b authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-6315 Set 'required' indicator on 'hero image' field on blog, event and...

ISTWCMS-6315 Set 'required' indicator on 'hero image' field on blog, event and news item content types
parent 11e93730
No related branches found
No related tags found
1 merge request!338ISTWCMS-6315 Set 'required' indicator on 'hero image' field on blog, event and...
......@@ -999,6 +999,22 @@ function uw_cfg_common_form_alter(array &$form, FormStateInterface $form_state,
unset($form['settings']['hide_branding']);
}
// Only blog, event and news item has 'Image' option.
$hero_image_form_ids = [
'node_uw_ct_blog_form',
'node_uw_ct_blog_edit_form',
'node_uw_ct_event_form',
'node_uw_ct_event_edit_form',
'node_uw_ct_news_item_form',
'node_uw_ct_news_item_edit_form',
];
if (in_array($form_id, $hero_image_form_ids)) {
// Set required when hero image field shows.
if (isset($form['field_uw_hero_image']['widget'])) {
$form['field_uw_hero_image']['widget']['#required'] = TRUE;
}
}
// Prevent redirects to pilots or staging URLs.
if ($form_id == 'redirect_redirect_form' || $form_id == 'redirect_redirect_edit_form') {
$form['#validate'][] = '_uw_cfg_common_redirect_destination_validation';
......
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