Skip to content

Commit

Permalink
Added support for having acf join group form action use a dynamic civ…
Browse files Browse the repository at this point in the history
…i group id
  • Loading branch information
wcha-peter committed Apr 4, 2023
1 parent 2f9b403 commit 904ebbd
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2578,6 +2578,9 @@ public function tab_mapping_accordion_group_add() {
$choices[ $group['id'] ] = $group['title'];
}

// Add choice to represent using a custom hook for the group id
$choices[0] = 'civicrm_profile_sync_acfe_dynamic_group hook';

// Add Group choices and modify Field.
$group_field['choices'] = $choices;
$group_field['search_placeholder'] = '';
Expand Down Expand Up @@ -6055,6 +6058,11 @@ public function form_group_save( $contact, $group_data ) {
}
}

// If group_id is zero, attempt to set it the result of a filter
if ( $group['group_id'] == 0 ) {
$group['group_id'] = apply_filters( 'civicrm_profile_sync_acfe_dynamic_group', $group );
}

// Skip if there's no Group ID.
if ( empty( $group['group_id'] ) ) {
continue;
Expand Down

0 comments on commit 904ebbd

Please sign in to comment.