Skip to content
delta.install 3.48 KiB
Newer Older
<?php
// $Id$

/**
 * @file
 * Contains install, update, and uninstall functions for Skinr.
 */

/**
 * Implementation of hook_schema.
 */
function delta_schema() {
  $schema['delta_theme_settings'] = array(
    'description' => t('Stores theme-settings templates that allow overriding the theme settings used based on various contexts.'),
    'fields' => array(
      'tid' => array(
        'description' => 'The unique ID of the theme settings template',
        'type' => 'serial',
        'length' => 5,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'The friendly name of this theme settings template.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'system_name' => array(
        'description' => 'The system name of this theme settings template.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'theme' => array(
        'description' => 'The theme for which this theme settings template is relevant.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => t('Serialized data which is a copy of the theme settings array stored in the system table based on these overrides'),
        'type' => 'text',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array('tid'),
    'indexes' => array(
      'theme' => array('theme'),
      'system_name' => array('system_name'),
      'tid' => array('tid'),
    ),
  );

  $schema['delta_theme_overrides'] = array(
    'description' => t('Override criteria for when to display an alternate theme settings template.'),
    'fields' => array(
      'did' => array(
        'description' => 'The unique ID of the theme settings override',
        'type' => 'serial',
        'length' => 5,
        'not null' => TRUE,
      ),
      'tid' => array(
        'description' => t('The template id this override uses. Relates to the tid field in {delta_theme_settings}'),
        'type' => 'int',
        'length' => 5,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'The friendly name of this theme settings override.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'system_name' => array(
        'description' => 'The system name of this theme settings override.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'condition' => array(
        'description' => t('The condition in which this override fires.'),
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'description' => t('Weight field to prioritize the override.'),
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'status' => array(
        'description' => 'Boolean indicating whether or not this item is enabled.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array('did'),
  );

  return $schema;
}

/**
 * Implementation of hook_uninstall().
 */
function delta_uninstall() {
  // Remove all skinr variables.
  db_delete('variable')
    ->condition('name', 'delta_%', 'LIKE')
    ->execute();
}