_filter_tips($format_id, $long = FALSE)
Retrieves the filter tips.
string $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.
bool $long: (optional) Boolean indicating whether the long form of tips should be returned. Defaults to FALSE.
array An associative array of filtering tips, keyed by filter name. Each filtering tip is an associative array with elements:
function _filter_tips($format_id, $long = FALSE) { $formats = filter_formats(\Drupal::currentUser()); $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) { foreach ($format->filters() as $name => $filter) { if ($filter->status) { $tip = $filter->tips($long); if (isset($tip)) { $tips[$format->label()][$name] = array( 'tip' => array('#markup' => $tip), 'id' => $name, ); } } } } return $tips; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!filter!filter.module/function/_filter_tips/8.1.x