function _button_field_ajax_response in Button Field 7
Same name and namespace in other branches
- 8 button_field.module \_button_field_ajax_response()
Builds the response for an ajax callback.
1 call to _button_field_ajax_response()
- button_field_callback_ajax in ./
button_field.module - Callback function for the FAPI ajax framework, used on edit forms.
File
- ./
button_field.module, line 352 - Defines a field, widget and formatter for the button field type.
Code
function _button_field_ajax_response() {
// Check to see if a page redirect action was used.
$commands = array();
$url = NULL;
$force = FALSE;
if (isset($GLOBALS['_rules_action_drupal_goto_do'])) {
list($url, $force) = $GLOBALS['_rules_action_drupal_goto_do'];
}
// Check to see if we have a destination set and we are not forced to use a
// redirect action.
if (!$force && isset($_REQUEST['destination']) && !empty($_REQUEST['destination'])) {
$url = urldecode($_REQUEST['destination']);
}
// If we have a url that we need to set the location to, get an ajax location
// command to that url.
if (!empty($url)) {
$commands[] = button_field_ajax_command_location($url);
}
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}