You are here

slickgrid.install in Slickgrid 7

Same filename and directory in other branches
  1. 6 slickgrid.install
  2. 7.2 slickgrid.install

File

slickgrid.install
View source
<?php

/**
 * Implementation of hook_requirements().
 */
function slickgrid_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $slickgrid_library = drupal_get_library('slickgrid', 'slickgrid');
    foreach ($slickgrid_library['js'] as $path => $js) {
      if (!file_exists($path)) {
        $requirements['slickgrid'] = array(
          'severity' => REQUIREMENT_ERROR,
          'title' => $slickgrid_library['title'],
          'value' => $t('Missing'),
          'description' => $t('The slickgrid library isn\'t available so this module will not work. Please download slickgrid %version from !website.', array(
            '!website' => l($slickgrid_library['website'], $slickgrid_library['website']),
            '%version' => $slickgrid_library['version'],
          )),
        );
        break;
      }
    }
    if (!isset($requirements['slickgrid'])) {
      $requirements['slickgrid'] = array(
        'severity' => REQUIREMENT_OK,
        'title' => $slickgrid_library['title'],
        'value' => $slickgrid_library['version'],
      );
    }
  }
  return $requirements;
}

/**
 * Implementation of hook_schema().
 */
function slickgrid_schema() {
  $schema['slickgrid'] = array(
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The users UID.',
      ),
      'view_name' => array(
        'type' => 'varchar',
        'length' => '32',
        'default' => '',
        'not null' => TRUE,
        'description' => 'The unique name of the view. May only be alphanumeric characters plus underscores.',
      ),
      'display_id' => array(
        'type' => 'varchar',
        'length' => '64',
        'default' => '',
        'not null' => TRUE,
        'description' => 'An identifier for this display; usually generated from the display_plugin, so should be something like page or page_1 or block_2, etc.',
      ),
      'settings' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'description' => 'A serialized array of view settings.',
      ),
    ),
    'primary key' => array(
      'uid',
      'view_name',
    ),
    'foreign keys' => array(
      'id' => array(
        'table' => 'views_display',
        'columns' => array(
          'id' => 'display_id',
        ),
      ),
      'name' => array(
        'table' => 'views_view',
        'columns' => array(
          'name' => 'view_name',
        ),
      ),
    ),
  );
  return $schema;
}

Functions

Namesort descending Description
slickgrid_requirements Implementation of hook_requirements().
slickgrid_schema Implementation of hook_schema().