You are here

isotope.install in Isotope (with Masonry and Packery) 7.2

Same filename and directory in other branches
  1. 7 isotope.install

Installation functions.

File

isotope.install
View source
<?php

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

/**
 * Implements hook_schema().
 */
function 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' => '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 isotope_requirements($phase) {
  $requirements = array();
  if ($phase == "runtime") {
    $requirements['isotope'] = array(
      'title' => t('Isotope library'),
      'value' => t('Enabled'),
    );
    $isotope_scope = 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 . '/' . ISOTOPE_FILENAME,
        '%cdn' => 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' => ISOTOPE_FILENAME,
      ));
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
isotope_requirements Implements hook_requirements().
isotope_schema Implements hook_schema().