You are here

image_field_caption.install in Image Field Caption 8

Same filename and directory in other branches
  1. 7.2 image_field_caption.install
  2. 7 image_field_caption.install

Install, update and uninstall functions for the image caption module.

File

image_field_caption.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the image caption module.
 */

/**
 * Implements hook_schema().
 */
function image_field_caption_schema() {

  // Image Field Caption table.
  $schema['image_field_caption'] = array(
    'description' => 'The base table for the image_field_caption module.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'The entity type attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'bundle' => array(
        'description' => 'The bundle attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'field_name' => array(
        'description' => 'The field name attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The entity id attached to this caption',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'revision_id' => array(
        'description' => 'The entity id attached to this caption, or NULL if the entity type is not versioned',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'language' => array(
        'description' => 'The language attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'delta' => array(
        'description' => 'The sequence number for this caption, used for multi-value fields',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'caption' => array(
        'description' => 'The caption text.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'caption_format' => array(
        'description' => 'The caption format.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'indexes' => array(
      'entity_type' => array(
        'entity_type',
      ),
      'bundle' => array(
        'bundle',
      ),
      'entity_id' => array(
        'entity_id',
      ),
      'revision_id' => array(
        'revision_id',
      ),
      'language' => array(
        'language',
      ),
    ),
    'primary key' => array(
      'entity_type',
      'field_name',
      'entity_id',
      'language',
      'delta',
    ),
  );

  // Image Field Caption revision table.
  $schema['image_field_caption_revision'] = array(
    'description' => 'The revision table for the image_field_caption module.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'The entity type attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'bundle' => array(
        'description' => 'The bundle attached to this caption',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'field_name' => array(
        'description' => 'The field name attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The entity id attached to this caption',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'revision_id' => array(
        'description' => 'The entity id attached to this caption, or NULL if the entity type is not versioned',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'language' => array(
        'description' => 'The language attached to this caption',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'delta' => array(
        'description' => 'The sequence number for this caption, used for multi-value fields',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'caption' => array(
        'description' => 'The caption text.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'caption_format' => array(
        'description' => 'The caption format.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'indexes' => array(
      'entity_type' => array(
        'entity_type',
      ),
      'bundle' => array(
        'bundle',
      ),
      'entity_id' => array(
        'entity_id',
      ),
      'revision_id' => array(
        'revision_id',
      ),
      'language' => array(
        'language',
      ),
    ),
    'primary key' => array(
      'entity_type',
      'field_name',
      'entity_id',
      'revision_id',
      'language',
      'delta',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function image_field_caption_install() {
}

/**
 * Implements hook_uninstall().
 */
function image_field_caption_uninstall() {

  // @todo Programmatically set the default formatter for all fields that uses this field formatter.
}