You are here

function schema_get_schema in Schema 7

Same name and namespace in other branches
  1. 8 schema.module \schema_get_schema()

A copy of drupal_get_schema() optimized for schema module use.

8 calls to schema_get_schema()
drush_schema_compare in ./schema.drush.inc
Implements drush_COMMANDFILE_COMMANDNAME().
SchemaRegressionTest::testInspectionConflict518210 in tests/schema_regression.test
Test API for adding tables
schema_compare in ./schema.pages.inc
"Compare" menu callback.
schema_describe in ./schema.pages.inc
"Describe" menu callback.
schema_inspect in ./schema.pages.inc
"Inspect" menu callback.

... See full list

File

./schema.module, line 652
The Schema module provides functionality built on the Schema API.

Code

function schema_get_schema() {
  $schema =& drupal_static(__FUNCTION__);
  if (!isset($schema)) {
    $schema = array();
    module_load_all_includes('install');

    // Invoke hook_schema for all modules.
    foreach (module_implements('schema') as $module) {

      // Cast the result of hook_schema() to an array, as a NULL return value
      // would cause array_merge() to set the $schema variable to NULL as well.
      // That would break modules which use $schema further down the line.
      $current = (array) module_invoke($module, 'schema');

      // Set 'module' and 'name' keys for each table. Keep descriptions,
      // they are slow but very useful for this module.
      _drupal_schema_initialize($current, $module, FALSE);
      $schema = array_merge($schema, $current);
    }
    drupal_alter('schema', $schema);
  }
  return $schema;
}