1 filter.theme.inc theme_filter_tips($variables)

Returns HTML for a set of filter tips.

Parameters

$variables: An associative array containing:

  • tips: An array containing descriptions and a CSS ID in the form of 'module-name/filter-id' (only used when $long is TRUE) for each filter in one or more text formats. Example:
      array(
        'Raw HTML' => array(
          0 => array(
            'tip' => 'Web page addresses and email addresses turn into links automatically.',
            'id' => 'filter/2',
          ),
        ),
      );
    
  • long: (optional) Whether the passed-in filter tips contain extended explanations, i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a short format, i.e. suitable to be displayed below a form element. Defaults to FALSE.

See also

_filter_tips()

Related topics

File

core/modules/filter/filter.theme.inc, line 188
Theme functions for the Filter module.

Code

function theme_filter_tips($variables) {
  $tips = $variables['tips'];
  $long = $variables['long'];
  $output = '';

  $multiple = count($tips) > 1;
  if ($multiple) {
    $output = '<h2>' . t('Text formats') . '</h2>';
  }

  if (count($tips)) {
    if ($multiple) {
      $output .= '<div class="compose-tips">';
    }
    foreach ($tips as $name => $tip_list) {
      if ($multiple) {
        $output .= '<div class="filter-type filter-' . backdrop_html_class($name) . '">';
        $output .= '<h3>' . check_plain($name) . '</h3>';
      }

      if (count($tip_list) > 0) {
        $output .= '<ul class="tips">';
        foreach ($tip_list as $tip) {
          $output .= '<li' . ($long ? ' id="filter-' . str_replace("/", "-", $tip['id']) . '">' : '>') . $tip['tip'] . '</li>';
        }
        $output .= '</ul>';
      }

      if ($multiple) {
        $output .= '</div>';
      }
    }
    if ($multiple) {
      $output .= '</div>';
    }
  }

  return $output;
}