You are here

headerimage.install in Header image 7

Same filename and directory in other branches
  1. 5 headerimage.install
  2. 6 headerimage.install

File

headerimage.install
View source
<?php

/**
 * Implementation of hook_schema()
 */
function headerimage_schema() {
  $schema['headerimage'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'block' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '0',
      ),
      'weight' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'conditions' => array(
        'type' => 'text',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['headerimage_block'] = array(
    'fields' => array(
      'delta' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'delta',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_uninstall
 */
function headerimage_uninstall() {

  // Delete variables
  db_delete('variable')
    ->condition('name', 'headerimage_%%', 'LIKE')
    ->execute();
}

/**
 * Header image blocks should not be cached
 */
function headerimage_update_7000() {

  // Do not cache the headerimage block
  db_update('block')
    ->fields(array(
    'cache' => DRUPAL_NO_CACHE,
  ))
    ->condition('module', 'headerimage')
    ->execute();
}

Functions

Namesort descending Description
headerimage_schema Implementation of hook_schema()
headerimage_uninstall Implementation of hook_uninstall
headerimage_update_7000 Header image blocks should not be cached