home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (jquery_ui.install)

This example Drupal source code file (jquery_ui.install) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, directory, download, file, function, href, if, install, jquery_ui_version, jqueryui, phase, php, requirement_error, requirements

The jquery_ui.install Drupal example source code

<?php
// $Id: jquery_ui.install,v 1.5.2.4 2010/09/08 23:12:42 sun Exp $

/**
 * @file
 * Installation file for jQuery UI module.
 */

/**
 * Implementation of hook_requirements().
 */
function jquery_ui_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $jquery_ui_version = 0;

  if ($phase == 'install') {
    // The jquery_ui_get_version() function is in the .module file, which isn't
    // loaded yet.
    include_once dirname(__FILE__) . '/jquery_ui.module';
  }

  $requirements['jquery_ui']['title'] = $t('jQuery UI');
  if ($jquery_ui_version = jquery_ui_get_version()) {
    // Everything looks good; display the current jQuery UI version.
    $requirements['jquery_ui']['value'] = $jquery_ui_version;
    $requirements['jquery_ui']['severity'] = REQUIREMENT_OK;
  }
  else {
    // Required library wasn't found. Abort installation.
    $requirements['jquery_ui']['value'] = $t('Not found');
    // Provide a download link to the jQuery UI development bundle. The provided
    // link will list the latest 1.6.x build.
    $requirements['jquery_ui']['description'] = $t('The <a href="@jqueryui">jQuery UI</a> plugin is missing. <a href="@download">Download</a> and extract it to your <em>jquery_ui</em> module directory.', array(
      '@jqueryui' => 'http://jqueryui.com',
      '@download' => 'http://code.google.com/p/jquery-ui/downloads/list?q=1.6',
    ));
    $requirements['jquery_ui']['severity'] = REQUIREMENT_ERROR;
  }

  return $requirements;
}

/**
 * Implementation of hook_uninstall().
 */
function jquery_ui_uninstall() {
  variable_del('jquery_ui_compression_type');
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal jquery_ui.install source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.