You are here

function path_breadcrumbs_schema in Path Breadcrumbs 7.3

Same name and namespace in other branches
  1. 7 path_breadcrumbs.install \path_breadcrumbs_schema()
  2. 7.2 path_breadcrumbs.install \path_breadcrumbs_schema()

Implements hook_schema().

File

./path_breadcrumbs.install, line 41
Provides database structure for PATH BREADCRUMBS module.

Code

function path_breadcrumbs_schema() {

  // Create new cache table to store cached data from path_breadcrumbs.
  $schema['cache_path_breadcrumbs'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['cache_path_breadcrumbs']['description'] = 'Cache table used to store information about path breadcrumbs variants for every page.';

  // Table stores exportable breadcrumbs variants.
  $schema['path_breadcrumbs'] = array(
    'description' => 'Stores path breadcrumbs.',
    'export' => array(
      'key' => 'machine_name',
      'primary key' => 'path_id',
      'identifier' => 'path_breadcrumb',
      'default hook' => 'path_breadcrumbs_settings_info',
      'can disable' => FALSE,
      'load callback' => 'path_breadcrumbs_load_by_name',
      'load multiple callback' => 'path_breadcrumbs_load_by_name_multiple',
      'load all callback' => 'path_breadcrumbs_load_all',
      'export callback' => 'path_breadcrumbs_export',
      'list callback' => 'path_breadcrumbs_export_list',
      'api' => array(
        'owner' => 'path_breadcrumbs',
        'api' => 'path_breadcrumbs',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'path_id' => array(
        'description' => "Breadcrumb's variant unique identifier",
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'no export' => TRUE,
      ),
      'machine_name' => array(
        'description' => "Breadcrumb's variant machine name",
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => "Breadcrumb's variant human-readable name",
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'path' => array(
        'description' => 'URL where breadcrumb should be shown',
        'type' => 'varchar',
        'length' => 256,
        'not null' => TRUE,
      ),
      'data' => array(
        'description' => 'Serialized data of breadcrumb',
        'type' => 'blob',
        'not null' => TRUE,
        'size' => 'big',
        'serialize' => TRUE,
        'object default' => array(),
      ),
      'weight' => array(
        'description' => 'Breadcrumb weight related to other breadcrumbs',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'path_id',
    ),
    'unique keys' => array(
      'machine_name' => array(
        'machine_name',
      ),
    ),
  );
  return $schema;
}