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

quicksketch’s picture

You 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.

dragonwize’s picture

Status: Active » Fixed

Marking as fixed. Re-open if quicksketches comment was not sufficient.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

lolandese’s picture

For others stumbling into this, now available: http://drupal.org/project/link_image