background image
HomeRecent PostsDrupalSearchTagsRSSContactAboutAccount
Eric.London's picture

I wanted to add a CCK radio field to a node type that used images instead of text. The images were included in my module. First I created a CCK node type and added a field of text/radios. At the bottom of the page, you can enter PHP for your allowed value list...

<?php

$imagePath
= base_path() . drupal_get_path('module', 'MYMODULE') . '/images';
return array(
 
'smile' => "<img src='$imagePath/face-smile.png' />",
 
'plain' => "<img src='$imagePath/face-plain.png' />",
 
'sad' => "<img src='$imagePath/face-sad.png' />",
);
?>

Here's a screenshot of the result:

Syndicate content