function panels_ajax_context_item_delete in Panels 6.2
Ajax entry point to edit an item
1 string reference to 'panels_ajax_context_item_delete'
- panels_menu in ./
panels.module - Implementation of hook_menu
File
- includes/
common-context.inc, line 923 - includes/common-context.inc Provide API for adding contexts for modules that embed displays.
Code
function panels_ajax_context_item_delete($module = NULL, $type = NULL, $panel_name = NULL, $position = NULL) {
panels_load_include('plugins');
panels_load_include('ajax');
if (!isset($position)) {
return panels_ajax_render();
}
// Load stored object from cache.
if (!($object = panels_cache_get("panel_object:{$module}", $panel_name))) {
panels_ajax_render(t('Invalid panel name.'));
}
$type_info = panels_common_context_info($type);
// Create a reference to the place our context lives. Since this is fairly
// generic, this is the easiest way to get right to the place of the
// object without knowing precisely what data we're poking at.
$ref =& $object->{$type_info['key']};
if (!array_key_exists($position, $ref)) {
panels_ajax_render(t('Unable to delete missing item!'));
}
unset($ref[$position]);
panels_cache_set("panel_object:{$module}", $panel_name, $object);
$output = new stdClass();
$output->type = $output->output = 'dismiss';
$output->replace = array(
'#' . $type . '-row-' . $position => '',
);
$output->exec = "Drupal.Panels.restripeTable('#{$type}-table');";
panels_ajax_render($output);
}