Closed (fixed)
Project:
Link
Version:
6.x-2.5
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2008 at 01:53 UTC
Updated:
27 Apr 2012 at 07:06 UTC
I try to create Image Formatter in function link_field_formatter_info() but I don't see anything.
I add line in link_field_formatter_info()
'image' => array(
'label' => t('URL, as image'),
'field types' => array('link'),
'multiple values' => CONTENT_HANDLE_CORE,
),
I create theme_link_formatter_image($element)
function theme_link_formatter_image($element) {
return empty($element['#item']['url']) ? 'noimage.png' : check_plain($element['#item']['url']);
}
I add line in link_theme()
'link_formatter_image' => array(
'arguments' => array('element' => NULL),
),
What is wrong?
Thank you!
Comments
Comment #1
quicksketchYou probably shouldn't be adding code directly into the link.module if you want to add a new formatter. Instead you can create a custom module that implements hook_formatter_info() and create your own formatters. You might check out CCK Extras module, which adds a "Screenshot" formatter to links and can provide a good example of how you can make your own formatters rather than editing the link.module.
Comment #2
dragonwize commentedMarking as fixed. Re-open if quicksketches comment was not sufficient.
Comment #4
lolandese commentedFor others stumbling into this, now available: http://drupal.org/project/link_image