function _path_breadcrumbs_ui_add_form_finish_ajax_callback in Path Breadcrumbs 7.2
Same name and namespace in other branches
- 7.3 path_breadcrumbs_ui/path_breadcrumbs_ui.module \_path_breadcrumbs_ui_add_form_finish_ajax_callback()
Ajax callback for last step of breadcrumbs creating. Saves new path breadcrumb.
_state
Parameters
$form:
Return value
array
1 string reference to '_path_breadcrumbs_ui_add_form_finish_ajax_callback'
- _path_breadcrumbs_ui_form_attach_buttons in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Attach ajax-processed buttons to the form.
File
- path_breadcrumbs_ui/
path_breadcrumbs_ui.module, line 314 - Provide user interface for CRUD operations with path breadcrumbs.
Code
function _path_breadcrumbs_ui_add_form_finish_ajax_callback($form, &$form_state) {
if (!form_get_errors()) {
// Save breadcrumb from cache to permanent storage.
$breadcrumb = path_breadcrumbs_object_cache_get($form_state['storage']['machine_name']);
path_breadcrumbs_save($breadcrumb);
drupal_set_message(filter_xss(t('New breadcrumb !name was created.', array(
'!name' => $breadcrumb->name,
))));
// Redirect user to page with breadcrumbs list.
ctools_include('ajax');
// Ajax responder not required since CTools 7.x-1.0 but this line
// should be added to keep module works properly.
ctools_add_js('ajax-responder');
$commands = array();
$commands[] = ctools_ajax_command_redirect('admin/structure/path-breadcrumbs');
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}
return $form;
}