You are here

function shortcode_add_class in Shortcode 6

Same name and namespace in other branches
  1. 7.2 shortcode.module \shortcode_add_class()
  2. 7 shortcode.module \shortcode_add_class()

Class parameter helper function

Parameters

$class:

$default:

5 calls to shortcode_add_class()
shortcode_basic_tags_shortcode_button in shortcode_basic_tags/shortcode_basic_tags.module
shortcode_basic_tags_shortcode_clear in shortcode_basic_tags/shortcode_basic_tags.module
shortcode_basic_tags_shortcode_dropcap in shortcode_basic_tags/shortcode_basic_tags.module
shortcode_basic_tags_shortcode_highlight in shortcode_basic_tags/shortcode_basic_tags.module
Insert a span around the text with highlight css class
shortcode_basic_tags_shortcode_quote in shortcode_basic_tags/shortcode_basic_tags.module
Replace a given text formatted like a quote.

File

./shortcode.module, line 571

Code

function shortcode_add_class($class = '', $default = '') {
  if ($class) {
    if (!is_array($class)) {
      $class = explode(' ', $class);
    }
    array_unshift($class, $default);
    $class = array_unique($class);
  }
  else {
    $class[] = $default;
  }
  return implode(' ', $class);
}