You are here

function _responsivewrappers_add_class in Responsive wrappers 7

Add or append a class in a selected HTML tag.

1 call to _responsivewrappers_add_class()
_responsivewrappers_process in ./responsivewrappers.module
Process callback for the responsive wrappers filter.

File

./responsivewrappers.module, line 166
Responsive bootstrap wrappers input filter.

Code

function _responsivewrappers_add_class($text, $tag, $class) {

  // If HTML class property exists append, if not create the class property.
  if (strpos('class="', $text) !== FALSE) {
    $text = str_replace('class="', 'class="' . $class . ' ', $text);
  }
  else {
    $text = str_replace('<' . $tag . ' ', '<' . $tag . ' class="' . $class . '" ', $text);
  }
  return $text;
}