You are here

function template_preprocess_attachment_links in Attachment Links 6

Same name and namespace in other branches
  1. 7 attachment_links.module \template_preprocess_attachment_links()

Preprocess the output for attachment links.

Parameters

$vars The theme variables array. After this function is called, these: keys will be available in the array:

  • attachment_links: An array of keyed attachment link arrays. Each array in this array has the following keys:

    • 'url' - The URL for that item's attachment.
    • 'weight' - The relative weight for that attachment within attachment_links.
    • 'default render' - A default rendering of the singular item.
  • default_render: A default unordered list rendering for the attachment links as generated by theme('item_list',...).

Return value

unknown_type

File

./attachment_links.module, line 301
The Attachment Links module provides permanent links to files attached to a node. A single, easy-to-remember URL can be used to retrieve the preferred (canonical) or newest version of a file regardless of how many versions of that file have been…

Code

function template_preprocess_attachment_links(&$vars) {

  // -- Define a translatable title. This will not appear in the upload form.
  if ($vars['display_type'] != 'upload_form') {
    $vars['attachment_links_title'] = t('Attachment links');
  }

  // -- Build an array of links.
  $links = attachment_links_build_links($vars['node']);

  // -- Create a default item list rendering.
  $items = array();
  foreach ($links as $key => $link) {
    $items[] = $link['default render'];
  }
  $vars['attachment_links'] = theme('item_list', $items);
}