countdown.module in Countdown 7.2
Same filename and directory in other branches
Count to, or from, a specified date and display the output in a block
File
countdown.moduleView source
<?php
/**
 * @file
 * Count to, or from, a specified date and display the output in a block
 */
/**
 * Implement hook_help().
 *
 * @param string $section
 * @return string
 */
function countdown_help($path, $arg) {
  $output = '';
  switch ($path) {
    case 'admin/help#countdown':
      $output = t("Provides a Boxes plugin showing a countdown, with pluggable JS implementations.");
      break;
  }
  return $output;
}
/**
 * Implements hook_ctools_plugin_api().
 */
function countdown_ctools_plugin_api($module, $api) {
  if ($module == 'boxes' && $api == 'plugins') {
    return array(
      'version' => 1,
    );
  }
}
/**
 * Implements hook_boxes_plugins().
 */
function countdown_boxes_plugins() {
  $info = array();
  $path = drupal_get_path('module', 'countdown') . '/plugins';
  $info['countdown'] = array(
    'title' => 'Countdown box',
    'handler' => array(
      'class' => 'countdown_box',
      'file' => 'countdown_box.inc',
      'path' => $path,
    ),
  );
  return $info;
}
/**
 * Implements hook_ctools_plugin_type().
 *
 * Defines the 'countdown' plugin type.
 * This uses file discovery rather than a hook, so implementing modules need to
 * implement hook_ctools_plugin_directory().
 * The plugin definition should contain:
 *  - 'label': The human-readable label of the plugin. This is shown in the
 *    box admin form.
 *  - 'description': A longer description of the plugin. This is shown in the
 *    box admin form.
 *  - 'callback': The name of an implementation of
 *    callback_countdown_countdown_build(). This returns the render array for
 *    the countdown. This may be located in the plugin file.
 *  - 'supported_options': An array of options this plugin supports. These
 *    should match the options defined in countdown_box::options_defaults().
 */
function countdown_ctools_plugin_type() {
  // Declare our plugin type.
  $plugins['countdown'] = array(
    // New plugins are only introduced by new modules, so should be cached.
    'cache' => TRUE,
    // We don't use a centralized info hook, just file discovery.
    // @see countdown_ctools_plugin_directory().
    'use hooks' => FALSE,
  );
  return $plugins;
}
/**
 * Implements hook_ctools_plugin_directory().
 */
function countdown_ctools_plugin_directory($owner, $plugin_type) {
  if ($owner == 'countdown' && $plugin_type == 'countdown') {
    return 'plugins/countdown';
  }
}Functions
| Name   | Description | 
|---|---|
| countdown_boxes_plugins | Implements hook_boxes_plugins(). | 
| countdown_ctools_plugin_api | Implements hook_ctools_plugin_api(). | 
| countdown_ctools_plugin_directory | Implements hook_ctools_plugin_directory(). | 
| countdown_ctools_plugin_type | Implements hook_ctools_plugin_type(). | 
| countdown_help | Implement hook_help(). | 
