You are here

barcode.install in Barcode 6

Same filename and directory in other branches
  1. 6.2 barcode.install
  2. 7.2 barcode.install

Implementation of hook_install().

File

barcode.install
View source
<?php

/**
 * @file
 * Implementation of hook_install().
 */
function barcode_install() {
  drupal_load('module', 'content');
  content_notify('install', 'barcode');
}

/**
 * Implementation of hook_uninstall().
 */
function barcode_uninstall() {
  drupal_load('module', 'content');
  content_notify('uninstall', 'barcode');
}

/**
 * Implementation of hook_enable().
 *
 * Notify content module when this module is enabled.
 */
function barcode_enable() {
  drupal_load('module', 'content');
  content_notify('enable', 'barcode');
}

/**
 * Implementation of hook_disable().
 *
 * Notify content module when this module is disabled.
 */
function barcode_disable() {
  drupal_load('module', 'content');
  content_notify('disable', 'barcode');
}

/**
 * Implementation of hook_requirements().
 */
function barcode_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    // File paths
    $barcode_path = file_create_path(rtrim(variable_get('barcode_default_path', 'barcodes')));
    if (!file_check_directory($barcode_path, FILE_CREATE_DIRECTORY)) {
      $requirements['barcode_dirs'] = array(
        'value' => t('Missing directory'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t("The barcode module's barcode directory %barcode-dir is missing.", array(
          '%barcode-dir' => $barcode_path,
        )),
      );
    }
    else {
      $requirements['barcode_dirs'] = array(
        'value' => t('Exists (%path)', array(
          '%path' => $barcode_path,
        )),
        'severity' => REQUIREMENT_OK,
      );
    }
    $requirements['barcode_dirs']['title'] = t('Barcode module directories');
  }
  return $requirements;
}

Functions

Namesort descending Description
barcode_disable Implementation of hook_disable().
barcode_enable Implementation of hook_enable().
barcode_install @file Implementation of hook_install().
barcode_requirements Implementation of hook_requirements().
barcode_uninstall Implementation of hook_uninstall().