function _filter_tips
Same name in other branches
- 9 core/modules/filter/filter.module \_filter_tips()
- 8.9.x core/modules/filter/filter.module \_filter_tips()
- 10 core/modules/filter/filter.module \_filter_tips()
- 11.x core/modules/filter/filter.module \_filter_tips()
Retrieves the filter tips.
Parameters
$format_id: The ID of the text format for which to retrieve tips, or -1 to return tips for all formats accessible to the current user.
$long: (optional) Boolean indicating whether the long form of tips should be returned. Defaults to FALSE.
Return value
An associative array of filtering tips, keyed by filter name. Each filtering tip is an associative array with elements:
- tip: Tip text.
- id: Filter ID.
2 calls to _filter_tips()
- filter_tips_long in modules/
filter/ filter.pages.inc - Page callback: Displays a page with long filter tips.
- theme_filter_guidelines in modules/
filter/ filter.module - Returns HTML for guidelines for a text format.
File
-
modules/
filter/ filter.module, line 1063
Code
function _filter_tips($format_id, $long = FALSE) {
global $user;
$formats = filter_formats($user);
$filter_info = filter_get_filters();
$tips = array();
// If only listing one format, extract it from the $formats array.
if ($format_id != -1) {
$formats = array(
$formats[$format_id],
);
}
foreach ($formats as $format) {
$filters = filter_list_format($format->format);
$tips[$format->name] = array();
foreach ($filters as $name => $filter) {
if ($filter->status && isset($filter_info[$name]['tips callback']) && function_exists($filter_info[$name]['tips callback'])) {
$tip = $filter_info[$name]['tips callback']($filter, $format, $long);
if (isset($tip)) {
$tips[$format->name][$name] = array(
'tip' => $tip,
'id' => $name,
);
}
}
}
}
return $tips;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.