The ImageField Extended widget adds new form fields to the CCK ImageField widget. All processing, including storage, is done via ImageField. This module simply allows you to easily extend the currently available form fields; alt, description, title, etc, and either let the themers to run their magic, you can use the Custom Formatters module or use the new CCK formatter to display the additional text fields (Help hiding the labels can be found here).
We have used a single multivalue ImageField "Image, with additional fields" field to do all of the following in 3 projects.
- Header image checkbox, usage has been at both the page and node level.
- Featured teaser list image flag.
- Block image of existing page's node.
- Adding alternative links to the image
- Extra info to the rendered image. Our main usage is to add new attributes for JScript. We haven't actually added a caption yet!
- Embedded gallery of selected images
Security note
Remember security if you handle the data yourself. The recommended method to handle the text fields are:
Typical text field (no HTML)
<?php
$no_markup = isset($data['no_markup']['body']) ? check_plain($data['no_markup']['body']) : NULL;
?>
Text field with tags (HTML)
<?php
# You can use filter_xss_admin for TRUSTED users.
$free_text = isset($data['free_text']['body']) ? filter_xss($data['free_text']['body']) : NULL;
?>
Rich text (WYSIWYG)
<?php
$rich_text = '';
if (isset($data['rich_text']) && !empty($data['rich_text']['body'])) {
$rich_text = check_markup($data['rich_text']['body'], $data['rich_text']['format'], FALSE);
}
?>
Remember that the title from the key|title pairs is also user input. Run this through check_plain() too!
The following pages are used to help demonstrate possible theming uses.