Posted by Loocor on December 7, 2009 at 4:19am
1 follower
| Project: | Imce CCK Image |
| Version: | 6.x-1.0-beta2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (to be ported) |
Issue Summary
抱歉,英文太差,因为项目需要新增了两个显示模式,针对 imceimage.module 文件修改的代码如下:
<?php
function imceimage_field_formatter_info() {
$formatters = array(
'default' => array(
'label' => 'Default',
'field types' => array('imceimage'),
'multiple values' => CONTENT_HANDLE_CORE,
),
'with_caption' => array(
'label' => 'With caption',
'field types' => array('imceimage'),
'multiple values' => CONTENT_HANDLE_CORE,
),
'link' => array(
'label' => 'Link',
'field types' => array('imceimage'),
'multiple values' => CONTENT_HANDLE_CORE,
),
'thumb' => array(
'label' => 'Thumbnail',
'field types' => array('imceimage'),
'multiple values' => CONTENT_HANDLE_CORE,
),
'thumblink' => array(
'label' => 'ThumbLink',
'field types' => array('imceimage'),
'multiple values' => CONTENT_HANDLE_CORE,
),
'thumblink_caption' => array(
'label' => 'ThumbLink Caption',
'field types' => array('imceimage'),
'multiple values' => CONTENT_HANDLE_CORE,
),
);
?><?php
/**
* <a href="mailto:Loocor@live.com" rel="nofollow">Loocor@live.com</a>, displays the thumb with a link.
**/
function theme_imceimage_formatter_thumblink($element) {
$item = $element['#item'];
$field = $element['#field_name'];
$delta = $element['#delta'];
$id = "imceimage-". $field ."-". $delta . '-thumb';
$thumb = _imceimage_get_thumb($item);
return '<a href="' . $item['imceimage_path'] .'" class="imceimage-link">' . theme_imceimage_image($thumb['imceimage_path'], $thumb['imceimage_width'],$thumb['imceimage_height'],$thumb['imceimage_alt'],$id) . '</a>';
}
/**
* <a href="mailto:Loocor@live.com" rel="nofollow">Loocor@live.com</a>, displays the thumb with a link and caption.
**/
function theme_imceimage_formatter_thumblink_caption($element) {
$item = $element['#item'];
$field = $element['#field_name'];
$delta = $element['#delta'];
$id = "imceimage-". $field ."-". $delta . '-thumb';
$thumb = _imceimage_get_thumb($item);
$caption = $item['imceimage_alt'];
return "<div class='image-with-caption'><div class='image'>" . '<a href="' . $item['imceimage_path'] .'" class="imceimage-link">' . theme_imceimage_image($thumb['imceimage_path'], $thumb['imceimage_width'],$thumb['imceimage_height'],$thumb['imceimage_alt'],$id) . '</a>' ."</div><div class='caption' style='font-style:italic'>". $caption ."</div></div>";
}
?>因为不熟悉patch,请朋友帮忙处理一下。