You are here

function ctools_export_crud_new in Chaos Tool Suite (ctools) 6

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

Create a new object for the given $table.

Parameters

$table: The name of the table to use to retrieve $schema values. This table must have an 'export' section containing data or this function will fail.

$set_defaults: If TRUE, which is the default, then default values will be retrieved from schema fields and set on the object.

Return value

The loaded object.

Related topics

4 calls to ctools_export_crud_new()
ctools_custom_content_type_edit_form_submit in plugins/content_types/custom/custom.inc
The submit form stores the data in $conf.
ctools_custom_content_type_get_conf in plugins/content_types/custom/custom.inc
Given a subtype and a $conf, return the actual settings to use.
ctools_export_ui::add_page in plugins/export_ui/ctools_export_ui.class.php
ctools_export_ui::import_page in plugins/export_ui/ctools_export_ui.class.php
Page callback to import information for an exportable item.

File

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

Code

function ctools_export_crud_new($table, $set_defaults = TRUE) {
  $schema = ctools_export_get_schema($table);
  $export = $schema['export'];
  if (!empty($export['create callback']) && function_exists($export['create callback'])) {
    return $export['create callback']($set_defaults);
  }
  else {
    return ctools_export_new_object($table, $set_defaults);
  }
}