You are here

function cvm_field_field_schema in Contextual View Modes 7

Implements hook_field_schema().

Defines the database schema of the field, using the format used by the Schema API.

File

modules/cvm_field/cvm_field.install, line 35

Code

function cvm_field_field_schema($field) {
  $schema = array(
    'columns' => array(
      'view_mode' => array(
        'description' => 'The view mode to use when context validates',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'context' => array(
        'description' => 'The context to authenticate against',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'view_mode' => array(
        'view_mode',
      ),
      'context' => array(
        'context',
      ),
      'view_context' => array(
        'view_mode',
        'context',
      ),
    ),
    'foreign keys' => array(
      'context' => array(
        'table' => 'context',
        'columns' => array(
          'context' => 'name',
        ),
      ),
      'view_mode' => array(
        'table' => 'ds_view_modes',
        'columns' => array(
          'view_mode' => 'view_mode',
        ),
      ),
    ),
  );
  return $schema;
}