You are here

function shortcode_basic_tags_shortcode_link in Shortcode 7

Same name and namespace in other branches
  1. 6 shortcode_basic_tags/shortcode_basic_tags.module \shortcode_basic_tags_shortcode_link()
  2. 7.2 shortcode_basic_tags/shortcode_basic_tags.module \shortcode_basic_tags_shortcode_link()

File

shortcode_basic_tags/shortcode_basic_tags.module, line 362

Code

function shortcode_basic_tags_shortcode_link($attrs, $text) {
  extract(shortcode_attrs(array(
    'path' => '<front>',
    'title' => '',
  ), $attrs));
  $path = drupal_get_path_alias($path);

  //dpr($attrs);
  if ($text) {
    $class = empty($class) ? '' : ' class="' . $class . '"';
    $style = empty($style) ? '' : ' style="' . $style . '"';
    $id = empty($id) ? '' : ' id="' . $id . '"';
    if ($title == '<none>') {
      $title = '';
    }
    else {
      $title = empty($title) ? check_plain($text) : check_plain($title);
      $title = ' title="' . $title . '"';
    }
    return '<a href="' . $path . '"' . $id . $class . $style . $title . '>' . $text . '</a>';
  }
  return $path;
}