function button_field_callback_ajax in Button Field 7
Same name and namespace in other branches
- 8 button_field.module \button_field_callback_ajax()
Callback function for the FAPI ajax framework, used on edit forms.
1 string reference to 'button_field_callback_ajax'
- _button_field_build_element in ./
button_field.module - Builds the renderable array for a button field widget.
File
- ./
button_field.module, line 44 - Defines a field, widget and formatter for the button field type.
Code
function button_field_callback_ajax(&$form, &$form_state) {
// Get the field that was clicked.
$language = $form['language']['#value'];
$field_name = $form_state['triggering_element']['#array_parents'][0];
$field = $form_state['field'][$field_name][$language]['field'];
// Get the entity and its type.
list($entity_type, $entity) = _button_field_callback_get_entity($form, $form_state, $field_name, $language);
// Trigger the rules event.
$entity_wrapper = entity_metadata_wrapper($entity_type, $entity);
rules_invoke_all('button_field_clicked', $field, $entity_wrapper);
return _button_field_ajax_response();
}