You are here

function ctools_export_crud_load in Chaos Tool Suite (ctools) 7

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

Load a single exportable object.

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.

$name: The unique ID to load. The field for this ID will be specified by the export key, which normally defaults to 'name'.

Return value

The loaded object.

Related topics

15 calls to ctools_export_crud_load()
CtoolsExportCrudTestCase::testCrudExportDelete in tests/ctools_export_test/ctools_export.test
Tests CRUD operation: Delete.
CtoolsExportCrudTestCase::testCrudExportLoad in tests/ctools_export_test/ctools_export.test
Tests CRUD operation: Load.
CtoolsExportCrudTestCase::testCrudExportRevert in tests/ctools_export_test/ctools_export.test
Tests CRUD operation: Revert.
CtoolsExportCrudTestCase::testCrudExportSave in tests/ctools_export_test/ctools_export.test
Tests CRUD operation: Save.
CtoolsExportCrudTestCase::testCrudExportSetStatus in tests/ctools_export_test/ctools_export.test
Tests CRUD operation: Set status.

... See full list

File

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

Code

function ctools_export_crud_load($table, $name) {
  $schema = ctools_export_get_schema($table);
  $export = $schema['export'];
  if (!empty($export['load callback']) && function_exists($export['load callback'])) {
    return $export['load callback']($name);
  }
  else {
    $result = ctools_export_load_object($table, 'names', array(
      $name,
    ));
    if (isset($result[$name])) {
      return $result[$name];
    }
  }
}