You are here

function theme_shrinktheweb_formatter_shrinktheweb_link_separate in ShrinkTheWeb 7

Theme function for 'separate' text field formatter.

File

./shrinktheweb.module, line 357

Code

function theme_shrinktheweb_formatter_shrinktheweb_link_separate($vars) {
  $preview = theme('shrinktheweb_image', array(
    'url' => $vars['element']['url'],
    'options' => array(
      'attributes' => array(
        'class' => array(
          'shrinktheweb',
        ),
      ),
    ),
  ));
  $class = empty($vars['element']['attributes']['class']) ? '' : ' ' . $vars['element']['attributes']['class'];
  unset($vars['element']['attributes']['class']);
  $title = empty($vars['element']['title']) ? '' : check_plain($vars['element']['title']);
  $output = '';
  $output .= '<div class="link-item ' . $class . '">';
  if (!empty($title)) {
    $output .= '<div class="link-title">' . $title . '</div>';
  }
  if (!empty($preview)) {
    $output .= '<div class="link-preview">' . $preview . '</div>';
  }
  $output .= '<div class="link-url">' . l($vars['element']['url'], $vars['element']['url'], array(
    'attributes' => $vars['element']['attributes'],
  )) . '</div>';
  $output .= '</div>';
  return $output;
}