You are here

function theme_lightbox2_file_formatter_lightbox2_iframe in Lightbox2 6

Theme function for the lightbox iframe filefield formatter.

Parameters

$file: Filefield file object.

$field: The CCK field the action is being performed on.

$file_formatter_settings: File formatter settings; ignored.

Return value

Themed link to filefield.

1 theme call to theme_lightbox2_file_formatter_lightbox2_iframe()
theme_lightbox2_formatter_filefield_lightframe in ./lightbox2.formatter.inc
Theme function for the lightbox iframe filefield formatter.

File

./lightbox2.formatter.inc, line 315
Lightbox2 formatter hooks and callbacks.

Code

function theme_lightbox2_file_formatter_lightbox2_iframe($file, $field, $file_formatter_settings) {
  $path = $file->filepath;
  $url = file_create_url($path);
  $icon = theme('filefield_icon', $file);
  $file_data = $file->data;
  if (is_string($file_data)) {
    $file_data = unserialize($file->data);
  }
  $description = $file_data['description'];
  if (empty($description)) {
    $description = $file->filename;
  }
  $attributes = array();
  $attributes['id'] = 'lightbox2-node-link-text';
  $target = variable_get('lightbox2_node_link_target', FALSE);
  if (!empty($target)) {
    $attributes['target'] = $target;
  }
  $node_link = '';
  $node_link_text = check_plain(variable_get('lightbox2_node_link_text', 'View Image Details'));
  if (!empty($node_link_text)) {
    $node_link .= '<br /><br />' . l($node_link_text, $url, array(
      'attributes' => $attributes,
    ));
  }

  // Only files with supported extensions make it this far, so no need to check here.
  $link_attributes = array(
    'rel' => 'lightframe[][' . $description . $node_link . ']',
  );
  return '<div class="filefield-formatter-lightbox2-iframe">' . $icon . l($description, $url, array(
    'attributes' => $link_attributes,
  )) . '</div>';
}