You are here

function theme_shrinktheweb_formatter_shrinktheweb_link_default in ShrinkTheWeb 7

Theme function for 'default' text field formatter.

File

./shrinktheweb.module, line 242

Code

function theme_shrinktheweb_formatter_shrinktheweb_link_default($vars) {
  $preview = theme('shrinktheweb_image', array(
    'url' => $vars['element']['url'],
    'options' => array(
      'attributes' => array(
        'class' => array(
          'shrinktheweb',
        ),
      ),
    ),
  ));

  // Display a normal link if both title and URL are available.
  if (!empty($vars['element']['title']) && !empty($vars['element']['url'])) {
    return $preview . l($vars['element']['title'], $vars['element']['url'], array(
      'attributes' => $vars['element']['attributes'],
    ));
  }
  elseif (!empty($vars['element']['title'])) {
    return check_plain($vars['element']['title']);
  }
  elseif (!empty($vars['element']['url'])) {
    return $preview . l($vars['element']['title'], $vars['element']['url'], array(
      'attributes' => $vars['element']['attributes'],
    ));
  }
}