Index: img_assist.module
===================================================================
--- img_assist.module (revision 26)
+++ img_assist.module (working copy)
@@ -1015,6 +1015,23 @@
'#description' => NULL,
'#attributes' => array('onblur' => 'parent.updateCaption()'),
);
+
+ $form['include-in-caption'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Include in caption'),
+ 'title-include' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Title'),
+ '#default_value' => TRUE,
+ '#attributes' => array('onblur' => 'parent.updateCaption()'),
+ ),
+ 'desc-include' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Description'),
+ '#default_value' => TRUE,
+ '#attributes' => array('onblur' => 'parent.updateCaption()'),
+ ),
+ );
// Size.
$form[] = array('#value' => '
| ');
@@ -1730,18 +1747,24 @@
function theme_img_assist_inline($node, $size, $attributes) {
$caption = '';
- if ($attributes['title'] && $attributes['desc']) {
- $caption = ''. $attributes['title'] .': '. $attributes['desc'];
+
+ // Are title and description to be included in the caption?
+ // Also check they even exist!
+ $caption_desc = $attributes['desc-include'] ? $attributes['desc'] : "";
+ $caption_title = $attributes['title-include'] ? $attributes['title'] : "";
+ if ($caption_title && $caption_desc) {
+ $caption = ''. $caption_title .': '. $caption_desc;
}
- elseif ($attributes['title']) {
- $caption = ''. $attributes['title'] .'';
+ elseif ($caption_title) {
+ $caption = ''. $caption_title .'';
}
- elseif ($attributes['desc']) {
- $caption = $attributes['desc'];
+ elseif ($caption_desc) {
+ $caption = $caption_desc;
}
+
// Change the node title because img_assist_display() uses the node title for
// alt and title.
- $node->title = strip_tags($caption);
+ $node->title = trim($attributes['title'] . " " . $attributes['desc']);
$img_tag = img_assist_display($node, $size);
// Always define an alignment class, even if it is 'none'.
|