You are here

editablefields.install in Editable Fields 6.3

Provides installation related function to editablefields module.

File

editablefields.install
View source
<?php

/**
 * @file
 * Provides installation related function to editablefields module.
 */

/**
 * Implementation of hook_schema().
 */
function editablefields_schema() {
  $schema['editablefields_preset'] = array(
    'description' => t('Table storing preset definitions.'),
    'export' => array(
      'key' => 'name',
      'identifier' => 'preset',
      // Exports will be defined as $preset
      'default hook' => 'default_editablefields_preset',
      // Function hook name.
      'api' => array(
        'owner' => 'editablefields',
        'api' => 'default_editablefields_presets',
        // Base name for api include files.
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'Unique ID for presets. Used to identify them programmatically.',
      ),
      'pid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        'no export' => TRUE,
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'A human readable name of a preset.',
      ),
      'config' => array(
        'type' => 'text',
        'size' => 'big',
        'description' => 'Configuration data.',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function editablefields_install() {
  drupal_install_schema('editablefields');
}

/**
 * Implementation of hook_install().
 */
function editablefields_uninstall() {
  drupal_uninstall_schema('editablefields');
}

/**
 * Update to the 6.x-3.x branch.
 */
function editablefields_update_6000() {
  $ret = array();

  // Check the new dependency on Ctools.
  if (!module_exists('ctools')) {
    $ret['#abort'] = array(
      'success' => FALSE,
      'query' => 'Editablefields
    6.x-3.x requires the Ctools module. No updates were run.',
    );
    return $ret;
  }
  $ret[] = array(
    'success' => TRUE,
    'query' => t('Installing schema.'),
  );

  // install schema
  $schema_ret = drupal_install_schema('editablefields');
  $ret = array_merge($ret, $schema_ret);
  return $ret;
}

Functions

Namesort descending Description
editablefields_install Implementation of hook_install().
editablefields_schema Implementation of hook_schema().
editablefields_uninstall Implementation of hook_install().
editablefields_update_6000 Update to the 6.x-3.x branch.