Only in ./image_caption/contrib: image_caption_filter.css
diff -r -up ./image_caption_orig/contrib/image_caption_filter.module ./image_caption/contrib/image_caption_filter.module
--- ./image_caption_orig/contrib/image_caption_filter.module 2008-11-14 03:23:31.000000000 -0600
+++ ./image_caption/contrib/image_caption_filter.module 2009-05-26 00:13:33.000000000 -0500
@@ -30,7 +30,17 @@ function image_caption_filter_help($path
return $output;
} //function image_caption_filter_help
-//filter hook implementation
+
+/**
+ * Implementation of hook_init().
+ */
+function image_caption_filter_init() {
+ drupal_add_css(drupal_get_path('module', 'image_caption_filter') . '/image_caption_filter.css');
+}
+
+/**
+ * Implementation of hook_filter().
+ */
function image_caption_filter_filter($op, $delta = 0, $format = -1, $text = '') {
switch ($op) {
case 'list':
@@ -47,12 +57,37 @@ function image_caption_filter_filter($op
//Look for
tags and run the doImgTitles function on the
tag
$text = preg_replace_callback('|()|s', 'doImgTitles', $text);
return $text;
+
+ case "settings":
+ if ($delta == 0) {
+ return _image_caption_settings($format);
+ }
default:
return $text;
}
} //function image_caption_filter_filter
+/**
+ * Settings for the image_caption filter.
+ * based on the HTML filter
+ */
+function _image_caption_settings($format) {
+ // print('the format: '. $format);
+ $form['image_caption'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('HTML filter'),
+ '#collapsible' => TRUE,
+ );
+ $form['image_caption']['image_caption_'. $format] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Do not show "Missing ALT text" warning.'),
+ '#default_value' => variable_get('image_caption_'. $format, ''),
+ '#description' => t('Whether to show a prominent warning if ALT text is missing from an image.'),
+ );
+ return $form;
+}
+
//helper function to do the actual manipulation
function doImgTitles($matches) {
@@ -69,15 +104,17 @@ function doImgTitles($matches) {
//Get class out of the
tag
preg_match ('/class=\"(.+?)\"/i', $imgText, $matches);
$class = $matches[1];
-
+
+
//See if there is an alt attribute in the
tag, if not insert a LOUD warning
preg_match ('/alt=\"(.+?)\"/i', $imgText, $matches);
$alt = $matches[1];
- if (empty($alt)) {
+ if (empty($alt) && variable_get('image_caption_1', 0) != 0) {
$alt_warning = 'No alternate text on picture! - define alternate text in image properties';
} else {
$alt_warning = '';
}
+ // $alt_warning = '';
//Only insert the caption and modify the
tag if it is has a title attribute and is one of the classes we are interested in
if (in_array($class, array('image-left', 'image-right', 'standalone-image')) && ($title)) {