You are here

dynamic_banner.install in Dynamic Banner 8.x

The install file of dynamic_banner

File

dynamic_banner.install
View source
<?php

/**
 * @file
 *  The install file of dynamic_banner
 */

/**
 * Implements hook_schema().
 * Will create the database needed to store the banner connections
 */
function dynamic_banner_schema() {
  $schema['dynamic_banner'] = array(
    'description' => 'The table for the path to banner relationship',
    'fields' => array(
      'dbid' => array(
        'description' => 'The primary key always unique',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'path' => array(
        'description' => 'The path of the page where this banner will live',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
      ),
      'imgurl' => array(
        'description' => 'The path of the image for the banner',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
        'default' => NULL,
      ),
      'imgfid' => array(
        'description' => 'If the image is managed these are the fids of the image for the banner',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
        'default' => NULL,
      ),
      'text' => array(
        'description' => 'The text to display on this relationship',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'link' => array(
        'description' => 'The link to make the banner point to',
        'type' => 'varchar',
        'length' => '255',
        'not null' => FALSE,
      ),
      'mode' => array(
        'description' => 'The Mode for this page, will be things like time_base, rotating, fade, normal (visual mode)',
        'type' => 'varchar',
        'length' => '30',
        'not null' => FALSE,
      ),
      'start_time' => array(
        'description' => 'The Start time for this banner, when it activates',
        'type' => 'varchar',
        'length' => '60',
        'not null' => FALSE,
        'default' => NULL,
      ),
      'end_time' => array(
        'description' => 'The End time for this banner, when it expires',
        'type' => 'varchar',
        'length' => '60',
        'not null' => FALSE,
        'default' => NULL,
      ),
    ),
    'primary key' => array(
      'dbid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_install().
 */
function dynamic_banner_install() {

  // Default settings install
  variable_set('dynamic_banner_display_setting', 'urltext');
  variable_set('dynamic_banner_display_errors', FALSE);
  variable_set('dynamic_banner_file_save_path', BANNER_DEFAULT_SAVE_LOCATION);
  drupal_set_message(st('Dynamic Banner Module installed successfully. Proceed to !link', array(
    '!link' => l('Dynamic Banner Settings', 'admin/structure/banners'),
  )), 'warning');
}

/**
 * Implements hook_uninstall().
 */
function dynamic_banner_uninstall() {

  // Module settings remove
  variable_del('dynamic_banner_display_setting');
  variable_del('dynamic_banner_display_errors');
  variable_del('dynamic_banner_file_save_path');
  drupal_set_message(st('Dynamic Banner Module uninstalled successfully.'), 'warning');
}

Functions

Namesort descending Description
dynamic_banner_install Implements hook_install().
dynamic_banner_schema Implements hook_schema(). Will create the database needed to store the banner connections
dynamic_banner_uninstall Implements hook_uninstall().