Skip to content

Commit

Permalink
Afform - Use filter instead of grouping to indicate placement require…
Browse files Browse the repository at this point in the history
…s url

This leaves grouping open for other uses, like storing the entityType
  • Loading branch information
colemanw committed Feb 11, 2025
1 parent 5ca888b commit e86e458
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CRM/Utils/Array.php
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ public static function formatForSelect2(array $options, string $label = 'label',
if (!empty($option['children'])) {
$option['children'] = self::formatForSelect2($option['children'], $label, $id);
}
$option = array_intersect_key($option, array_flip(['id', 'text', 'children', 'color', 'icon', 'description', 'grouping']));
$option = array_intersect_key($option, array_flip(['id', 'text', 'children', 'color', 'icon', 'description', 'grouping', 'filter']));
}
return $options;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/admin/Civi/AfformAdmin/AfformAdminMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AfformAdminMeta {
*/
public static function getAdminSettings() {
$afformPlacement = \CRM_Utils_Array::formatForSelect2((array) \Civi\Api4\OptionValue::get(FALSE)
->addSelect('value', 'label', 'icon', 'description', 'grouping')
->addSelect('value', 'label', 'icon', 'description', 'grouping', 'filter')
->addWhere('is_active', '=', TRUE)
->addWhere('option_group_id:name', '=', 'afform_placement')
->addOrderBy('weight')
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/admin/ang/afGuiEditor/afGuiEditor.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
let requiresServerRoute = false;
editor.afform.placement.forEach(function(placement) {
const item = editor.meta.afform_placement.find(item => item.id === placement);
if (item && item.grouping === 'server_route') {
if (item && item.filter) {
requiresServerRoute = item.text;
}
});
Expand Down
2 changes: 1 addition & 1 deletion ext/afform/core/managed/AfformPlacement.mgd.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
'is_active' => TRUE,
'icon' => 'fa-bars',
// Indicates that a server_route is required for this placement
'grouping' => 'server_route',
'filter' => 1,
'description' => E::ts('Add to the contact summary actions menu.'),
],
'match' => ['option_group_id', 'name'],
Expand Down

0 comments on commit e86e458

Please sign in to comment.