You are here

function panelizer_schema in Panelizer 7.3

Same name and namespace in other branches
  1. 6 panelizer.install \panelizer_schema()
  2. 7 panelizer.install \panelizer_schema()
  3. 7.2 panelizer.install \panelizer_schema()

Implements hook_schema().

File

./panelizer.install, line 10
Install, update and uninstall functions for the panelizer module.

Code

function panelizer_schema() {
  $schema = array();

  // Fields that are shared between the two tables.
  $common_fields = array(
    'view_mode' => array(
      'type' => 'varchar',
      'length' => '128',
      'description' => 'Contains the view mode this panelizer is for.',
      'not null' => TRUE,
    ),
    'did' => array(
      'type' => 'int',
      'not null' => TRUE,
      'description' => 'The display ID of the panel.',
      'no export' => TRUE,
    ),
    'name' => array(
      'type' => 'varchar',
      'length' => '255',
      'description' => 'The name of the default being used if there is one.',
    ),
    'css_id' => array(
      'type' => 'varchar',
      'length' => '255',
      'description' => 'The CSS ID this panel should use.',
      'default' => '',
    ),
    'css_class' => array(
      'type' => 'varchar',
      'length' => '255',
      'description' => 'The CSS class this panel should use.',
      'default' => '',
    ),
    'css' => array(
      'type' => 'text',
      'size' => 'big',
      'description' => 'Any CSS the author provided for the panel.',
      'object default' => '',
    ),
    'no_blocks' => array(
      'type' => 'int',
      'size' => 'tiny',
      'description' => 'Whether or not the node disable sidebar blocks.',
      'default' => 0,
    ),
    'title_element' => array(
      'type' => 'varchar',
      'length' => '255',
      'description' => 'The HTML element the title should use.',
      'default' => 'H2',
    ),
    'link_to_entity' => array(
      'type' => 'int',
      'size' => 'tiny',
      'description' => 'Whether or not the title should link to the entity.',
      'default' => 1,
    ),
    'extra' => array(
      'type' => 'text',
      'size' => 'big',
      'description' => 'Contains extra data that can be added by modules.',
      'serialize' => TRUE,
      'object default' => array(),
    ),
    'pipeline' => array(
      'type' => 'varchar',
      'length' => '255',
      'description' => 'The render pipeline this panel uses.',
      'default' => 'standard',
    ),
    'contexts' => array(
      'type' => 'text',
      'size' => 'big',
      'description' => 'The contexts configured by the node author.',
      'serialize' => TRUE,
      'object default' => array(),
    ),
    'relationships' => array(
      'type' => 'text',
      'size' => 'big',
      'description' => 'The relationship contexts configured by the node author.',
      'serialize' => TRUE,
      'object default' => array(),
    ),
  );
  $schema['panelizer_entity'] = array(
    'export' => array(
      'bulk export' => FALSE,
      'can disable' => FALSE,
      'identifier' => 'panelizer_node',
    ),
    'description' => 'Node panelizer references.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'The type of the entity this panel is attached to.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'entity_id' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The entity ID this panel is attached to.',
      ),
      'revision_id' => array(
        'description' => 'The revision id of the entity.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ) + $common_fields,
    'primary key' => array(
      'entity_type',
      'entity_id',
      'revision_id',
      'view_mode',
    ),
    'indexes' => array(
      'revision_id' => array(
        'revision_id',
      ),
    ),
  );
  $schema['panelizer_defaults'] = array(
    'description' => 'Node type panelizer references.',
    'export' => array(
      'primary key' => 'pnid',
      'key' => 'name',
      'key name' => 'Name',
      'admin_title' => 'title',
      'identifier' => 'panelizer',
      'default hook' => 'panelizer_defaults',
      'api' => array(
        'owner' => 'panelizer',
        'api' => 'panelizer',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
      // 'create callback' => 'panelizer_export_create_callback',
      'save callback' => 'panelizer_export_save_callback',
      'export callback' => 'panelizer_export_export_callback',
      'delete callback' => 'panelizer_export_delete_callback',
      'subrecords callback' => 'panelizer_export_delete_callback_subrecords',
    ),
    'fields' => array(
      'pnid' => array(
        'type' => 'serial',
        'description' => 'The database primary key.',
        'no export' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'The human readable title of this default.',
      ),
      'panelizer_type' => array(
        'type' => 'varchar',
        'length' => '32',
        'description' => 'The panelizer entity type, such as node or user.',
      ),
      'panelizer_key' => array(
        'type' => 'varchar',
        'length' => '128',
        'description' => 'The panelizer entity bundle.',
      ),
      'access' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'Contains the access control for editing this default.',
        'serialize' => TRUE,
        'object default' => array(),
      ),
    ) + $common_fields,
    'primary key' => array(
      'pnid',
    ),
    'indexes' => array(
      'name' => array(
        'name',
      ),
      'type_key' => array(
        'panelizer_type',
        'panelizer_key',
      ),
    ),
  );
  return $schema;
}