Skip to content

Commit

Permalink
WVIC-48 Add Contact APIv4 joins for primary email, address, phone
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-justin committed Nov 22, 2021
1 parent 610cb06 commit 7b0834c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shortcodes/civicrm/api4-get.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ public function shortcode_callback( $atts = [], $content = NULL, $tag = '' ) {

$params = apply_filters( $this->get_shortcode_name() . '/params', $params, $atts );

if ($atts['entity'] == 'Contact') {
$params['join'] = [
['Email AS email', 'LEFT', ['email.is_primary', '=', TRUE]],
['Address AS address', 'LEFT', ['address.is_primary', '=', TRUE]],
['Phone AS phone', 'LEFT', ['phone.is_primary', '=', TRUE]],
];
}

try {
$trkey = $this->get_shortcode_name() . '__' . md5( $atts['entity'] . ':get:' . json_encode( $params ) );

Expand Down

0 comments on commit 7b0834c

Please sign in to comment.