/[drupal]/contributions/modules/image_caption/image_caption.module
ViewVC logotype

Contents of /contributions/modules/image_caption/image_caption.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Fri Mar 7 05:46:23 2008 UTC (20 months, 3 weeks ago) by davidwhthomas
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-6--2
Changes since 1.1: +5 -6 lines
File MIME type: text/x-php
Drupal 6.x update
1 <?php
2 /**
3 * @file
4 * $Id$
5 * Image Captioner Module using JQuery
6 * Requires javascript as enabled on client pc
7 * Adds a caption to images with 'caption' as their class using JQuery
8 * Caption is taken from image html title attribute
9 * @author David Thomas
10 * @contact davidwhthomas@gmail.com
11 */
12
13 /**
14 * Implementation of hook_menu().
15 */
16
17 function image_caption_menu() {
18 $items = array();
19
20 $items['admin/settings/image_caption'] = array(
21 'path' => 'admin/settings/image_caption',
22 'title' => t('Image Caption Settings'),
23 'description' => t('Configure image caption settings.'),
24 'page callback' => 'drupal_get_form',
25 'page arguments' => array('image_caption_admin_settings'),
26 );
27 //'access arguments' => user_access('administer site configuration')
28 return $items;
29 }
30
31 /*
32 * Implementation of the hook_admin_settings()
33 */
34 function image_caption_admin_settings() {
35
36 //node type settings
37 $node_types = node_get_types();
38 foreach ($node_types as $type) {
39 $types[$type->type] = $type->name;
40 }
41 $form['image_caption_node_types'] = array(
42 '#type' => 'select',
43 '#title' => t('Select node types to include in image captioning'),
44 '#default_value' => variable_get('image_caption_node_types', array()),
45 '#multiple' => TRUE,
46 '#options' => $types
47 );
48 return system_settings_form($form);
49 }
50
51 /*
52 * Implementation of hook_nodeapi()
53 * On view, add captioning javascript to page for certain node types
54 */
55 function image_caption_nodeapi(&$node, $op) {
56
57 if ($op == 'view') {
58 if (in_array($node->type, variable_get('image_caption_node_types', array()))) {
59 $path = drupal_get_path('module', 'image_caption');
60 drupal_add_js($path.'/image_caption.js','module', 'header');
61 }
62 }
63 }

  ViewVC Help
Powered by ViewVC 1.1.2