You are here

function _shortcode_filter_tips in Shortcode 7.2

Implements callback_filter_tips().

Provides help for the ShortCode filter.

See also

filter_filter_info()

1 string reference to '_shortcode_filter_tips'
shortcode_filter_info in ./shortcode.module
Implements hook_filter_info().

File

./shortcode.module, line 86
Provides ShortCodes filter framework and API (like WP ShortCodes)

Code

function _shortcode_filter_tips($filter, $format, $long = FALSE) {
  $out = NULL;
  $shortcodes = shortcode_list_all_enabled($format);
  if (!empty($shortcodes)) {
    $tips = array();
    foreach ($filter->settings as $name => $enabled) {
      $callable_name = '';
      if ($enabled && !empty($shortcodes[$name]['tips callback']) && is_callable($shortcodes[$name]['tips callback'], FALSE, $callable_name)) {
        $tip = call_user_func_array($shortcodes[$name]['tips callback'], array(
          $format,
          $long,
        ));
        $tip = trim($tip);
        if ($tip) {
          $tips[] = $tip;
        }
      }
    }
    if ($tips) {
      $out = theme('item_list', array(
        'title' => t('ShortCodes usage'),
        'items' => $tips,
        'type' => 'ol',
      ));
    }
  }
  return $out;
}