Skip to content

Instantly share code, notes, and snippets.

@mecachisenros
Created September 20, 2016 20:59
Show Gist options
  • Save mecachisenros/08560041c65abbb37cca090d87d3674b to your computer and use it in GitHub Desktop.
Save mecachisenros/08560041c65abbb37cca090d87d3674b to your computer and use it in GitHub Desktop.
<?php
// register civicrm magic tags
add_filter( 'caldera_forms_get_magic_tags', 'set_civicrm_magic_tags', 1, 30 );
// do civicrm magic tags
add_filter('caldera_forms_do_magic_tag', 'do_civicrm_magic_tags', 10, 2);
function set_civicrm_magic_tags( $tags ){
$civicrm_tags = array(
'website_type_id'
);
$tags['civicrm'] = array(
'type' => __( 'CiviCRM Tags', 'caldera-forms-civicrm' ),
'tags' => $civicrm_tags,
'wrap' => array('{','}')
);
return $tags;
}
function do_civicrm_magic_tags( $magic_tag, $tag ){
if ($tag == '{website_type_id}') {
$magic_tag = 'TEST';
}
return $magic_tag;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment