You are here

views_isotope.install in Views Isotope (Deprecated) 7.2

Installation functions.

File

views_isotope.install
View source
<?php

/**
 * @file
 * Installation functions.
 */

/**
 * Implements hook_schema().
 */
function views_isotope_schema() {
  $schema['isotope_configurations'] = array(
    'description' => 'Table storing Isotope configurations.',
    'export' => array(
      'key' => 'name',
      'key name' => 'Name',
      'primary key' => 'pid',
      // Exports will be defined as $config.
      'identifier' => 'config',
      // Function hook name.
      'default hook' => 'default_isotope_configuration',
      'api' => array(
        'owner' => 'views_isotope',
        // Base name for api include files.
        'api' => 'default_isotope_configurations',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'pid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
        // Do not export database-only keys.
        'no export' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'Unique ID for configs. Used to identify them programmatically.',
      ),
      'admin_title' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'Human readable name.',
      ),
      'layoutMode' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'One of a list of Isotope Layout Modes.',
      ),
      'plugins' => array(
        'type' => 'text',
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'A serialized array of plugin names.',
      ),
      'transitionDuration' => array(
        'type' => 'varchar',
        'length' => '10',
        'description' => 'In CSS Time format.',
      ),
      'urlFilters' => array(
        'type' => 'int',
        'size' => 'tiny',
        'description' => 'Should filters be represented in URL?',
      ),
      'isFitWidth' => array(
        'type' => 'int',
        'size' => 'tiny',
        'description' => 'isFitWidth',
      ),
      'isHorizontal' => array(
        'type' => 'int',
        'size' => 'tiny',
        'description' => 'isHorizontal',
      ),
      'stamp' => array(
        'type' => 'varchar',
        'length' => '255',
        'description' => 'Selector of element to be stamped',
      ),
      'horizontalAlignment' => array(
        'type' => 'varchar',
        'length' => '3',
        'description' => 'Decimal between 0 and 1',
      ),
      'verticalAlignment' => array(
        'type' => 'varchar',
        'length' => '3',
        'description' => 'Decimal between 0 and 1',
      ),
      'isOriginLeft' => array(
        'type' => 'int',
        'size' => 'tiny',
        'description' => 'isOriginLeft',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_requirements().
 */
function views_isotope_requirements($phase) {
  $requirements = array();
  if ($phase == "runtime") {
    $requirements['isotope'] = array(
      'title' => t('Isotope library'),
      'value' => t('Enabled'),
    );
    $isotope_scope = views_isotope_check_library();

    // If Libraries API is enabled but the .js is not found within the
    // sites/all/libraries folder report a warning. The module will fall back to
    // its included copy so this isn't a showstopper.
    if (function_exists('libraries_get_path') && $isotope_scope == 'cdn') {
      $path = libraries_get_path('isotope');
      $path = !empty($path) ? $path : 'libraries/isotope';
      $requirements['isotope']['value'] = t('Isotope is not correctly using Libraries API');
      $requirements['isotope']['severity'] = REQUIREMENT_WARNING;
      $requirements['isotope']['description'] = t('Please install <a href="http://isotope.metafizzy.co/">Isotope</a> in <strong>%path</strong>. The module is using an external copy from %cdn', array(
        '%path' => $path . '/' . VIEWS_ISOTOPE_FILENAME,
        '%cdn' => VIEWS_ISOTOPE_CDN_PATH,
      ));
    }

    // If the external copy has been removed or renamed report an error. At this
    // point the module cannot function properly.
    if ($isotope_scope == FALSE) {
      $requirements['isotope']['value'] = t('Isotope is not correctly installed');
      $requirements['isotope']['severity'] = REQUIREMENT_ERROR;
      $requirements['isotope']['description'] = t('The external script is not available.  Please enable the Libraries API module AND install <a href="http://isotope.metafizzy.co/">Isotope</a> in the isotope directory in libraries (sites/all/libraries/isotope/%file).', array(
        '%file' => VIEWS_ISOTOPE_FILENAME,
      ));
    }
  }
  return $requirements;
}

/**
 * Add urlFilters field to isotope_configurations table.
 */
function views_isotope_update_7100() {
  $spec = array(
    'type' => 'int',
    'size' => 'tiny',
    'description' => 'Should filters be represented in URL?',
  );
  db_add_field('isotope_configurations', 'urlFilters', $spec);
}

/**
 * Add isOriginLeft field to isotope_configurations table.
 */
function views_isotope_update_7101() {
  $spec = array(
    'type' => 'int',
    'size' => 'tiny',
    'description' => 'isOriginLeft',
  );
  db_add_field('isotope_configurations', 'isOriginLeft', $spec);
}

Functions

Namesort descending Description
views_isotope_requirements Implements hook_requirements().
views_isotope_schema Implements hook_schema().
views_isotope_update_7100 Add urlFilters field to isotope_configurations table.
views_isotope_update_7101 Add isOriginLeft field to isotope_configurations table.