Commit de169a20 authored by jdwfly's avatar jdwfly
Browse files

rudimentary imagefield support.

parent 62842663
......@@ -10,6 +10,7 @@ if (jQuery().colorbox) {
// Colorbox it
});
$("a[rel='testing1']").colorbox();
$("a[rel='testing2']").colorbox();
$('.colorbox').colorbox();
};
}
......@@ -77,4 +77,42 @@ function colorbox_link_alter(&$links, $node) {
$links['image_size_'. $size]['href'] = $node->images[$size];
unset($links['image_size_'. $size]['query']);
}
}
/**
* Implementation of CCK hook_field_formatter_info().
*/
function colorbox_field_formatter_info() {
return array(
'colorbox_slideshow' => array(
'label' => t('Colorbox Slideshow'),
'field types' => array('filefield'),
'description' => t('Adds a colorbox slideshow to images'),
),
);
}
/**
* Implmentation of hook_theme().
*/
function colorbox_theme() {
$theme = array(
'colorbox_formatter_colorbox_slideshow' => array(
'arguments' => array('element' => NULL),
),
);
return $theme;
}
/**
* Theme function for our video formatter
*/
function theme_colorbox_formatter_colorbox_slideshow($element) {
// Inside a view $element may contain null data. In that case, just return.
if (empty($element['#item']['fid'])) {
return '';
}
$item = $element['#item'];
$imagetag = theme('imagefield_formatter_image_plain', $element);
$original_image_url = file_create_url($item['filepath']);
$class = 'imagefield imagefield-imagelink imagefield-'. $element['#field_name'];
return l($imagetag, $original_image_url, array('attributes' => array('class' => $class, 'rel' => 'testing2'), 'html' => TRUE));
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment