You are here

field_conditional_state.install in Field Conditional States 7

Same filename and directory in other branches
  1. 7.2 field_conditional_state.install

Install function for the field_conditional_state module.

File

field_conditional_state.install
View source
<?php

/**
 * @file
 * Install function for the field_conditional_state module.
 */

/**
 * Implements hook_install().
 */
function field_conditional_state_install() {

  // Set the module weight to 1000.
  db_query("UPDATE {system} SET weight = 100 WHERE name = 'field_conditional_state'");
}

/**
 * Implements hook_schema().
 */
function field_conditional_state_schema() {
  $schema['field_conditional_state'] = array(
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'The internal identifier condition.',
      ),
      'field_name' => array(
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'description' => 'The target field name.',
      ),
      'control_field' => array(
        'type' => 'varchar',
        'length' => '32',
        'not null' => TRUE,
        'description' => 'The control field name.',
      ),
      'state' => array(
        'type' => 'varchar',
        'length' => '15',
        'not null' => TRUE,
        'description' => 'The state type.',
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => '127',
        'not null' => TRUE,
        'description' => 'The bundle type.',
      ),
      'trigger_values' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'The trigger values.',
      ),
      'condition_type' => array(
        'type' => 'varchar',
        'length' => '3',
        'not null' => TRUE,
        'description' => 'The matching type.',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}

/**
* Change the field_conditional_state.trigger_values field from varchar to text
*/
function field_conditional_state_update_7100() {
  $spec = array(
    'type' => 'text',
    'not null' => TRUE,
    'description' => 'The trigger values.',
  );
  db_change_field('field_conditional_state', 'trigger_values', 'trigger_values', $spec);
}

Functions

Namesort descending Description
field_conditional_state_install Implements hook_install().
field_conditional_state_schema Implements hook_schema().
field_conditional_state_update_7100 Change the field_conditional_state.trigger_values field from varchar to text