-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#785 Differentiate smart group from regular group using icon in select2 field #17927
Conversation
(Standard links)
|
Thanks @monishdeb the fatal is gone but it still has the error where it doesn't show the group when editing an existing contact who has a group, e.g. http://core-17927-5hal8.test-1.civicrm.org:8001/civicrm/contact/add?reset=1&action=update&cid=204, with the warning about htmlspecialchars. |
Thanks @demeritcowboy for pointing that issue. I have updated the PR. Please have a look now. |
|
$hierarchy[$group['id']] = [ | ||
'title' => $spaces . $group['title'], | ||
$hierarchy[] = array( | ||
'id' => $group['id'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The array() syntax seems to have come back. While I personally prefer array() the civi standard is now square brackets.
$group = $params['group'] ?? NULL; | ||
if (!empty($group) && is_array($group)) { | ||
$group = CRM_Utils_Array::value('group', $params); | ||
if (!empty($group)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRM_Utils_Array::value is being mercilessly removed everywhere in civi. So it should be the original line $group = $params['group'] ?? NULL;
@demeritcowboy thanks for your thorough code review. I have fixed all the issues you have raised. Please have a look now. |
@@ -102,7 +102,7 @@ public static function buildQuickForm( | |||
} | |||
|
|||
if ($groupElementType == 'select') { | |||
$groupsOptions[$id] = $group['title']; | |||
$groupsOptions[$id] = $group; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have one more thing: line 109 just below also needs title
removed, e.g. if you add Group to a profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demeritcowboy actually its fine, because its affecting only the group select widget, which now takes the array of information instead of just group title, as now we are supporting select2. The reason why the entire $group array is set, Whereas for advanced checkbox widget, it still needs only the group title as per old behaivour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try adding group to a profile though and then using the profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops my bad ... updated now
Ok thanks looks good there's just the I think the block in CRM/Contact/Form/Contact.php can be simplified but it works as-is so can leave for some other time. |
This reverts commit ba2ad46.
Looks good. I'm done. |
OK thanks for all your review on this @demeritcowboy |
Thanks a lot, @demeritcowboy for thoroughly reviewing this patch |
Overview
Currently, there is no way to tell which group is smart or regular group from UI. It would be ideal to use icon against such smart group options to differentiate them from regular ones. This patch appends an icon against smart group option of the select2 widget
https://lab.civicrm.org/dev/core/-/issues/785
Before
After
Comments
resubmitted PR after fixing the regression encountered in https://lab.civicrm.org/dev/core/-/issues/1888
ping @eileenmcnaughton @demeritcowboy @lcdservices