You are here

supersized.install in Supersized 8

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

Install, update and uninstall functions for Supersized module.

File

supersized.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for Supersized module.
 */

/**
 * Implements hook_schema().
 */
function supersized_schema() {
  $schema['supersized'] = array(
    'description' => 'The table to hold settings of individual node',
    'fields' => array(
      'nid' => array(
        'description' => 'Node ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'settings' => array(
        'description' => 'Serpersized configuration',
        'type' => 'blob',
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_field_schema().
 */
function supersized_field_schema($field) {
  return array(
    'columns' => array(
      'fid' => array(
        'description' => 'The {file_managed}.fid being referenced in this field.',
        'type' => 'int',
        'not null' => FALSE,
        'unsigned' => TRUE,
      ),
      'alt' => array(
        'description' => "Alternative image text, for the image's 'alt' attribute.",
        'type' => 'varchar',
        'length' => 512,
        'not null' => FALSE,
      ),
      'title' => array(
        'description' => "Image title text, for the image's 'title' attribute.",
        'type' => 'varchar',
        'length' => 1024,
        'not null' => FALSE,
      ),
      'description' => array(
        'description' => 'A description of the slide.',
        'type' => 'text',
        'not null' => FALSE,
      ),
      'link' => array(
        'description' => "Link of slide",
        'type' => 'varchar',
        'length' => 2048,
        'not null' => FALSE,
      ),
      'width' => array(
        'description' => 'The width of the image in pixels.',
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'height' => array(
        'description' => 'The height of the image in pixels.',
        'type' => 'int',
        'unsigned' => TRUE,
      ),
    ),
    'indexes' => array(
      'fid' => array(
        'fid',
      ),
    ),
    'foreign keys' => array(
      'fid' => array(
        'table' => 'file_managed',
        'columns' => array(
          'fid' => 'fid',
        ),
      ),
    ),
  );
}

/**
 * Implements hook_requirements().
 */
function supersized_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break during installation.
  $t = get_t();

  // Test supersized JQuery plugin.
  $library = libraries_detect('supersized');
  if ($phase === 'runtime') {
    if (!empty($library)) {
      $requirements['supersized'] = array(
        'title' => $t('Supersized'),
        'value' => $t('Supersized 3.2.8 installed.'),
        'severity' => REQUIREMENT_OK,
      );
    }
    else {
      $url = l(t('here'), $library['download url']);
      $value = $t('Install version 3.2.8 of the Supersized (from !url) in a libraries directory such as "sites/all/libraries."', array(
        '!url' => $url,
      ));
      $requirements['supersized'] = array(
        'title' => $t('Supersized'),
        'value' => $value,
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}

/**
 * Create new database table {supersized}.
 */
function supersized_update_7001() {
  $schema = supersized_schema();
  db_create_table('supersized', $schema['supersized']);
}

Functions

Namesort descending Description
supersized_field_schema Implements hook_field_schema().
supersized_requirements Implements hook_requirements().
supersized_schema Implements hook_schema().
supersized_update_7001 Create new database table {supersized}.