You are here

function search_autocomplete_schema in Search Autocomplete 7.3

Same name and namespace in other branches
  1. 6.4 search_autocomplete.install \search_autocomplete_schema()
  2. 6.2 search_autocomplete.install \search_autocomplete_schema()
  3. 7.4 search_autocomplete.install \search_autocomplete_schema()
  4. 7.2 search_autocomplete.install \search_autocomplete_schema()

Implements hook_schema(). Set the schema of database

Return value

the schema for of the table to create

File

./search_autocomplete.install, line 20
This file is used to install/update/delete the module tables in database

Code

function search_autocomplete_schema() {

  // schema for search_autocomplete database
  $schema['search_autocomplete_forms'] = array(
    'description' => t('Store the forms to autocomplete using Search Autocomplete.'),
    'fields' => array(
      'fid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'Human readable name for the form',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'selector' => array(
        'description' => 'Reference id selector of the the form in drupal',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'description' => 'Form weight in table',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'enabled' => array(
        'description' => 'Define if autocomplete is activated or not',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'parent_fid' => array(
        'description' => 'Define if the from follows the configuration of another one',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'min_char' => array(
        'description' => 'Minimum of character before triggering suggestions',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 3,
      ),
      'max_sug' => array(
        'description' => 'Maximum number of suggestions',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 10,
      ),
      'no_results' => array(
        'description' => 'Maximum number of suggestions',
        'type' => 'varchar',
        'length' => 50,
        'not null' => FALSE,
        'default' => '-- no results --',
      ),
      'auto_submit' => array(
        'description' => 'Define if form should be autosubmitted when suggestion is choosen',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      'auto_redirect' => array(
        'description' => 'Define if user should be redirected to suggestion directly',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      'translite' => array(
        'description' => 'Define if suggestion searches should be translited',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      'data_source' => array(
        'description' => 'Should data come from callback or from static resource',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      'data_callback' => array(
        'description' => 'Callback URL for data source',
        'type' => 'varchar',
        'length' => 255,
        'default' => '',
      ),
      'data_static' => array(
        'description' => 'Static text as a data',
        'type' => 'text',
        'size' => 'big',
      ),
      'theme' => array(
        'description' => 'Theme to use with this form',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'lightness',
      ),
    ),
    'primary key' => array(
      'fid',
    ),
  );
  return $schema;
}