You are here

function theme_description_wrapper in Extra Field Description 7

Wrapper for extra description.

Parameters

array $variables: An associative array containing:

  • raw_string: Raw string, which need to wrap.
  • new_line: (optional) Set to TRUE, if need append new line character before.
  • class: (optional) Append class to wrapper. Use string for single class or array for few classes.

Return value

string Wrapped HTML.

5 theme calls to theme_description_wrapper()
extra_field_description_field_attach_form in ./extra_field_description.module
Implements hook_field_attach_form().
_extra_field_description_add_to_checkbox in ./extra_field_description.module
Helper function adds the extra description to the checkbox field.
_extra_field_description_add_to_description in ./extra_field_description.module
Helper function adds the extra description to a fieldset's description.
_extra_field_description_add_to_prefix in ./extra_field_description.module
Helper function adds the extra description to the field prefix.
_extra_field_description_add_to_title in ./extra_field_description.module
Helper function adds the extra description to the field title.

File

./extra_field_description.module, line 468
Main module functions for the extra_field_description module.

Code

function theme_description_wrapper(array $variables) {
  if ($variables['raw_string']) {
    if (is_string($variables['class'])) {
      $variables['class'] = array(
        $variables['class'],
      );
    }

    // Default classes.
    $default_class = array(
      'extra-description',
    );
    $variables['class'] = array_merge($variables['class'], $default_class);
    $class_string = implode(' ', $variables['class']);
    $html = "<div class='" . $class_string . "'>" . filter_xss($variables['raw_string'], _field_filter_xss_allowed_tags()) . "</div>";
    if ($variables['new_line']) {
      $html = "\n{$html}";
    }
    return $html;
  }
  return '';
}