You are here

jquery_plugin.module in jQuery plugins 5

Same filename and directory in other branches
  1. 6 jquery_plugin.module
  2. 7 jquery_plugin.module

File

jquery_plugin.module
View source
<?php

/**
 * Add a jQuery plugin to a page.
 */
function jquery_plugin_add($plugin) {
  static $plugins = array();
  if (!isset($plugins[$plugin])) {
    drupal_add_js(drupal_get_path('module', 'jquery_plugin') . '/jquery.' . $plugin . '.min.js');
    $plugins[$plugin] = TRUE;
  }
}

/**
 * Implementation of hook_jq().
 * http://drupal.org/project/jq
 */
function jquery_plugin_jq($op, $plugin = NULL) {
  if ($op == 'info') {
    $path = drupal_get_path('module', 'jquery_plugin');
    return array(
      'metadata' => array(
        'name' => t('Metadata'),
        'description' => t('This plugin is capable of extracting metadata from classes, random attributes, and child elements.'),
        'version' => '1.0',
        'url' => 'http://plugins.jquery.com/project/metadata',
        'files' => array(
          'js' => array(
            $path . '/jquery.metadata.min.js',
          ),
        ),
      ),
      'validate' => array(
        'name' => t('Validate'),
        'description' => t('Setup powerful client-side form validation. From a protoype in a few minutes to heavily customized validation rules, methods and messages.'),
        'version' => '1.1.1',
        'url' => 'http://plugins.jquery.com/project/validate',
        'files' => array(
          'js' => array(
            $path . '/jquery.validate.min.js',
          ),
        ),
      ),
    );
  }
}

Functions

Namesort descending Description
jquery_plugin_add Add a jQuery plugin to a page.
jquery_plugin_jq Implementation of hook_jq(). http://drupal.org/project/jq