You are here

function path_breadcrumbs_save in Path Breadcrumbs 7.2

Same name and namespace in other branches
  1. 7.3 path_breadcrumbs.module \path_breadcrumbs_save()
  2. 7 path_breadcrumbs.module \path_breadcrumbs_save()

Save path breadcrumb.

Parameters

$path_breadcrumbs: Object with path breadcrumb data.

Return value

int ID of inserted/updated path breadcrumb.

4 calls to path_breadcrumbs_save()
path_breadcrumbs_import_form_submit in path_breadcrumbs_ui/path_breadcrumbs_ui.admin.inc
Submit callback for path breadcrumbs import form.
path_breadcrumbs_ui_breadcrumbs_list_submit in path_breadcrumbs_ui/path_breadcrumbs_ui.admin.inc
Submit callback for path_breadcrumbs_ui_breadcrumbs_list form.
path_breadcrumbs_ui_edit_form_submit in path_breadcrumbs_ui/path_breadcrumbs_ui.module
Submit callback for path breadcrumbs EDIT form.
_path_breadcrumbs_ui_add_form_finish_ajax_callback in path_breadcrumbs_ui/path_breadcrumbs_ui.module
Ajax callback for last step of breadcrumbs creating. Saves new path breadcrumb.

File

./path_breadcrumbs.module, line 317
Provide core functions for path breadcrumbs modue.

Code

function path_breadcrumbs_save($path_breadcrumbs) {
  ctools_include('export');

  // Build array with full access data.
  if (!empty($path_breadcrumbs->access) && !empty($path_breadcrumbs->logic)) {
    $path_breadcrumbs->access['logic'] = $path_breadcrumbs->logic;
  }
  elseif (empty($path_breadcrumbs->access)) {
    $path_breadcrumbs->access = array();
  }

  // Ctools will serialize data itself.
  $path_breadcrumbs->data = array(
    'titles' => $path_breadcrumbs->titles,
    'paths' => $path_breadcrumbs->paths,
    'home' => $path_breadcrumbs->home,
    'translatable' => $path_breadcrumbs->translatable,
    'arguments' => $path_breadcrumbs->arguments,
    'access' => $path_breadcrumbs->access,
  );
  $save_result = ctools_export_crud_save('path_breadcrumbs', $path_breadcrumbs);

  // FALSE means error while saving.
  if ($save_result) {

    // Remove data from ctools object cache table.
    path_breadcrumbs_object_cache_clear($path_breadcrumbs->machine_name);

    // Allow modules to know that path_breadcrumbs were saved.
    $path_breadcrumbs->is_new = $save_result == SAVED_NEW;
    module_invoke_all('path_breadcrumbs_save', $path_breadcrumbs);
    cache_clear_all('path_breadcrumbs', 'cache', TRUE);
  }

  // Return saving result, SAVED_NEW or SAVED_UPDATED.
  return $save_result;
}