You are here

function ctools_export_set_object_status in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/export.inc \ctools_export_set_object_status()

Set the status of a default $object as a variable.

This is more efficient than ctools_export_set_status because it will actually unset the variable entirely if it's not necessary, this saving a bit of space.

3 calls to ctools_export_set_object_status()
ctools_export_crud_set_status in includes/export.inc
Change the status of a certain object.
page_manager_page_enable in page_manager/plugins/tasks/page.inc
Callback to enable/disable the page from the UI.
page_manager_save_page_cache in page_manager/page_manager.module
Write all changes from the page cache and clear it out.

File

includes/export.inc, line 1113
Contains code to make it easier to have exportable objects.

Code

function ctools_export_set_object_status($object, $new_status = TRUE) {
  $table = $object->table;
  $schema = ctools_export_get_schema($table);
  $export = $schema['export'];
  $status = variable_get($export['status'], array());

  // Compare.
  if (!$new_status && $object->export_type & EXPORT_IN_DATABASE) {
    unset($status[$object->{$export['key']}]);
  }
  else {
    $status[$object->{$export['key']}] = $new_status;
  }
  variable_set($export['status'], $status);
}