jquery_calendar.install in jQuery World Calendars API 7
Same filename and directory in other branches
Implements necessary hooks for un/installation.
File
jquery_calendar.installView source
<?php
/**
 * @file
 * Implements necessary hooks for un/installation.
 */
/**
 * @return array
 */
function _jquery_calendar_variables() {
  return array(
    'jquery_calendar_compression_level' => 'normal',
    'jquery_calendar_datepicker_theme' => 'smoothness',
  );
}
/**
 * Implements hook_requirements().
 */
function jquery_calendar_requirements($phase) {
  // Module API is not available at this point.
  drupal_load('module', 'jquery_calendar');
  // Return the $requirements array.
  return _jquery_calendar_requirements_check();
}
/**
 * Implements hook_enable().
 */
function jquery_calendar_enable() {
  // Notify user.
  drupal_set_message(st('jQuery Calendar API has been installed. Please set your settings in <a href="!link">configuration page</a>.', array(
    '!link' => url('admin/config/user-interface/jquery-calendar'),
  )));
}
/**
 * Implements hook_install().
 */
function jquery_calendar_install() {
  _jquery_calendar_variables_set(_jquery_calendar_variables());
}
/**
 * Implements hook_uninstall().
 */
function jquery_calendar_uninstall() {
  _jquery_calendar_variables_del(_jquery_calendar_variables());
}
/**
 * @param $variables
 */
function _jquery_calendar_variables_set($variables) {
  foreach ($variables as $key => $val) {
    variable_set($key, $val);
  }
}
/**
 * @param $variables
 */
function _jquery_calendar_variables_del($variables) {
  $variables = array_keys($variables);
  foreach ($variables as $variable) {
    variable_del($variable);
  }
}Functions
| 
            Name | 
                  Description | 
|---|---|
| jquery_calendar_enable | Implements hook_enable(). | 
| jquery_calendar_install | Implements hook_install(). | 
| jquery_calendar_requirements | Implements hook_requirements(). | 
| jquery_calendar_uninstall | Implements hook_uninstall(). | 
| _jquery_calendar_variables | |
| _jquery_calendar_variables_del | |
| _jquery_calendar_variables_set |