Home
login

Advanced topics

Acidfree Inline Filter

Acidfree offers a built-in inline filter for inserting Acidfree elements into the body of other elements. This allows you to write a story about your latest camping trip and include small photos from the trip in with your text. First, you must enable the filter for each input type (html, php, etc.) at admin -> input types (admin/filter) and clicking on 'configure' for each input type you want to have [acidfree:nnn] tags enabled for. Then make sure the 'acidfree inline filter' is checked and hit save. Now you can add [acidfree:nnn] tags in the body of other elements.

There has evidently been some confusion about what the nnn in the tag is. The nnn stands for the node ID of the Acidfree node you want to appear.

It is possible to change the way the [acidfree:nnn] tags look by adding a few name/value pairs. Note that any value that has spaces in it must be quoted either with single quotes ' or with double quotes ". Currently, the choices are:

  • title: use this string as the caption (Note that you can have the node title be the default caption by modifying the setting in admin/settings/acidfree)
  • align: {left,right}
  • size: {M, WxH} where M=max dimension and WxH=WidthxHeight
  • link: 'none' or relative or absolute url e.g. http://www.google.com or node/59. If set to none, thumbnail will not be a link
  • popup: any value. If set, it will cause the link to be a popup link
  • style: CSS style information for the image
  • class: additional class for the image

Examples

  • [acidfree:1234 size=300 align=right] - right aligned thumbnail of node 1234 with max dimension of 300 pixels
  • [acidfree:4321] - left aligned thumbnail of node 4321 (default thumbnail size)
  • [acidfree:3241 align=left size=320x240] - right aligned thumbnail of node 3241 with size = 320x240
  • [acidfree:3241 title='This is a different title' size=320 popup=true link="http://mysite.dom/"] - left aligned thumbnail of node 3241 with a title set, size = 320x240, link pointing to mysite.dom and target=blank_ set in the anchor
  • [acidfree:3241 link=none class='my-image your-image' style="border: 2 px grey inset;"] - left aligned thumbnail of 3241, default size, class set and new style info

Themes

Like the rest of Drupal, Acidfree was designed with theming in mind. Almost all of Acidfree drawing routines can be themed.

The two main drawing routines theme_acidfree_print_thumb_{$class} and theme_acidfree_print_full_{$class} are defined for each class (currently album, photo and video).

Let's assume you are writing a new theme called 'blowfish.' The first thing you should do is copy the acidfree.css from the modules/acidfree directory into your theme directory. This copy in the theme dir will override the default css file. Feel free to modify it to suit your theming needs. Then in your blowfish.theme file, you need to define each of the default Acidfree theme functions you want to override. The current list of themeable functions in Acidfree are as follows:

<?php
function theme_acidfree_album_contents($form) { /* show 'Album Contents' view for mass edits */ }
function
theme_acidfree_print_full_album($node) { /* show the full album */ }
function
theme_acidfree_print_thumb_album(&$node) { /* the an album thumbnail */ }
function
theme_acidfree_print_full_photo(&$node) { /* show a full photo */ }
function
theme_acidfree_print_thumb_photo(&$node, $parent=null) { /* show a photo thumbnail */ }
function
theme_acidfree_exif_data(&$node) { /* theme exif data for a photo */ }
function
theme_acidfree_print_full_video(&$node) { /* show a full video */ }
function
theme_acidfree_print_thumb_video(&$node, $parent=null) { /* show a video thumbnail*/ }
function
theme_video_quicktime_control(&$node) { /* theme the quicktime control */ }
function
theme_video_realmedia_control(&$node) { /* theme the realmedia control */ }
function
theme_video_windowsmedia_control(&$node) { /* theme the wm control */ }
?>

Of all of these, the most common to theme are theme_acidfree_print_thumb_album, theme_acidfree_print_thumb_photo, and theme_acidfree_print_thumb_video. Some people may want to theme theme_acidfree_print_full_album, but really all it does is draw the thumbnails of its contents in a table. So most people can get what they want simply by modifying the CSS for the rest of the drawn elements.

So you will need to create the following functions in your blowfish.theme file:

<?php
function blowfish_acidfree_print_thumb_album(&$node) { /* the an album thumbnail */ }
function
blowfish_acidfree_print_thumb_photo(&$node, $parent=null) { /* show a photo thumbnail */ }
function
blowfish_acidfree_print_full_video(&$node) { /* show a full video */ }
?>

Keep in mind that a lot of the theming can be done simply by changing the CSS of the existing theme. You can do this by copying the acidfree.css to your theme dir and then modifying it. One other advantage of this is that your theme will not be overwritten when you upgrade Acidfree in the future.

theming to reorder a CCK and call back to acidfree hooks

Ok, this may be more of a CCK theming question, but having added CCK fields to my acidfree album to allow more album meta data, I now wish to reorder the placement of CCK/acidfree fields. To achieve this, I've created my node-acidfree.tpl.php, but I'm finding that I'm having to recreate a lot of stuff, not just the fields I added.

How can I theme all my cck fields then add the acidfree album thumb as an acidfree theme call?

something but not quite like:
[code]
?php print $field_some-field[0]['view']; ?
?php print theme_acidfree_album($node); ?
[/code]

please help?