diff --git a/imagecache.module b/imagecache.module index 1eccf3e..ee81326 100644 --- a/imagecache.module +++ b/imagecache.module @@ -149,9 +149,13 @@ function imagecache_theme() { 'function' => 'theme_imagecache_formatter_default', ); $theme['imagecache_formatter_'. $preset['presetname'] .'_linked'] = array( - 'arguments' => array('element' => NULL), + 'arguments' => array('element' => NULL, 'absolute' => FALSE), 'function' => 'theme_imagecache_formatter_linked', ); + $theme['imagecache_formatter_'. $preset['presetname'] .'_linked_absolute'] = array( + 'arguments' => array('element' => NULL), + 'function' => 'theme_imagecache_formatter_linked_absolute', + ); $theme['imagecache_formatter_'. $preset['presetname'] .'_imagelink'] = array( 'arguments' => array('element' => NULL), 'function' => 'theme_imagecache_formatter_imagelink', @@ -655,6 +659,10 @@ function imagecache_field_formatter_info() { 'label' => t('@preset image linked to node', array('@preset' => $preset['presetname'])), 'field types' => array('image', 'filefield'), ); + $formatters[$preset['presetname'] .'_linked_absolute'] = array( + 'label' => t('@preset image linked to node (for rss)', array('@preset' => $preset['presetname'])), + 'field types' => array('image', 'filefield'), + ); $formatters[$preset['presetname'] .'_imagelink'] = array( 'label' => t('@preset image linked to image', array('@preset' => $preset['presetname'])), 'field types' => array('image', 'filefield'), @@ -690,7 +698,16 @@ function theme_imagecache_formatter_default($element) { return theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title'], array('class' => $class)); } -function theme_imagecache_formatter_linked($element) { +/** + * Theme formatter for imagecache preset with an absolute link to node. + */ +function theme_imagecache_formatter_linked_absolute($element) { + // Call the same correct imagecache_formatter_[preset]_linked with + // the absolute argument as TRUE + return theme(substr($element['#theme'], 0, -9), $element, TRUE); +} + +function theme_imagecache_formatter_linked($element, $absolute = FALSE) { // Inside a view $element may contain NULL data. In that case, just return. if (empty($element['#item']['fid'])) { return ''; @@ -707,7 +724,7 @@ function theme_imagecache_formatter_linked($element) { $imagetag = theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title']); $path = empty($item['nid']) ? '' : 'node/'. $item['nid']; $class = "imagecache imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}"; - return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE)); + return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE, 'absolute' => $absolute)); } function theme_imagecache_formatter_imagelink($element) {