From 85f7d86abe907bb2e2c7bdc0c822288feb22285f Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Tue, 31 May 2022 15:46:55 -0400 Subject: [PATCH] Enable ability to require tags in profiles Prior to this change, it was not possible to make tags required in a profile. --- CRM/Contact/Form/Edit/TagsAndGroups.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Contact/Form/Edit/TagsAndGroups.php b/CRM/Contact/Form/Edit/TagsAndGroups.php index e9ffa6f6677b..611f2751cf5e 100644 --- a/CRM/Contact/Form/Edit/TagsAndGroups.php +++ b/CRM/Contact/Form/Edit/TagsAndGroups.php @@ -137,6 +137,9 @@ public static function buildQuickForm( if (!empty($tags)) { $form->add('select2', 'tag', ts('Tag(s)'), $tags, FALSE, ['class' => 'huge', 'placeholder' => ts('- select -'), 'multiple' => TRUE]); + if ($isRequired) { + $form->addRule('tag', ts('Tag is a required field.'), 'required'); + } } // build tag widget