function wf_crm_ajax_item in Webform CiviCRM Integration 7.3
Add an ajax container to a form, and set an existing form element to control it
Parameters
$form: The entire form
$pathstr: A : separated string of nested array keys leading to the relevant form snippet
$control_element: str: Array key of the existing element to add ajax behavior to
$container: str: Array key of the container to be created
1 call to wf_crm_ajax_item()
- wf_crm_configure_form in ./
webform_civicrm_admin.inc - Drupal form builder callback Form to configure CiviCRM options for a Webform
File
- ./
webform_civicrm_admin.inc, line 1452
Code
function wf_crm_ajax_item(&$form, $pathstr, $control_element, $container) {
eval('$snippet = &$form[\'' . str_replace(':', "']['", $pathstr) . "'];");
$pathstr .= ':' . $container;
$id = 'civicrm-ajax-' . str_replace(array(
':',
'_',
), '-', $pathstr);
$snippet[$control_element]['#ajax'] = array(
'callback' => 'wf_crm_configure_form_ajax',
'pathstr' => $pathstr,
'wrapper' => $id,
'effect' => 'fade',
);
$snippet[$container] = array(
'#prefix' => '<div class="civicrm-ajax-wrapper" id="' . $id . '">',
'#type' => 'markup',
'#suffix' => '</div>',
);
}