function matrix_settings_throbber_delete in Matrix field 6.2
Menu callback to delete an element This is part one of the delete process. Accepts parameters via $_REQUEST Echos a delete confirm form.
1 string reference to 'matrix_settings_throbber_delete'
- matrix_menu in ./
matrix.module - Implementation of hook_menu().
File
- ./
admin.inc, line 106 - Provides functions used in the creation of matrix fields.
Code
function matrix_settings_throbber_delete() {
$field_name = $_REQUEST['field_name'];
$element_id = $_REQUEST['element_id'];
$confirm = $_REQUEST['confirm'];
$rc = $_REQUEST['rc'];
$cache_response = cache_get('matrix-' . $rc . '-' . $field_name);
//load existing elements from cache
$elements = (array) $cache_response->data;
if ($confirm == 'confirmed') {
unset($elements[$element_id]);
cache_set('matrix-' . $rc . '-' . $field_name, $elements);
//save all elements back to the cache
$list .= theme('matrix_settings_list', $elements, $rc);
echo drupal_to_js(array(
'list' => $list,
'data' => serialize($elements),
));
exit;
}
else {
$output = drupal_get_form('matrix_delete_button');
echo $output;
exit;
}
}