public function jQueryUiFilter::tips in jQuery UI filter 8.2
Generates a filter's tip.
A filter's tips should be informative and to the point. Short tips are preferably one-liners.
@todo Split into getSummaryItem() and buildGuidelines().
Parameters
bool $long: Whether this callback should return a short tip to display in a form (FALSE), or whether a more elaborate filter tips should be returned for template_preprocess_filter_tips() (TRUE).
Return value
string|null Translated text to display as a tip, or NULL if this filter has no tip.
Overrides FilterBase::tips
File
- src/
Plugin/ Filter/ jQueryUiFilter.php, line 107 - Contains \Drupal\jquery_ui_filter\Plugin\Filter\jQueryUiFilter.
Class
- jQueryUiFilter
- Provides a filter to generate jQuery UI accordion and tabs widgets.
Namespace
Drupal\jquery_ui_filter\Plugin\FilterCode
public function tips($long = FALSE) {
if ($long) {
$html = '<p>' . $this
->t('You can create jQuery UI accordion or tabs by inserting <code>[accordion]</code> or <code>[tabs]</code> wrappers. Examples:') . '</p>';
$html .= '<ul>';
foreach (self::$widgets as $name => $widget) {
$t_args = [
'@title' => $widget['title'],
'@name' => $name,
'@tag' => \Drupal::config('jquery_ui_filter.settings')
->get($name . '.options.headerTag') ?: 'h3',
'@href' => "http://jqueryui.com/demos/{$name}/",
];
$html .= '<li>' . $this
->t('Use <code>[@name]</code> and <code>[/@name]</code> with <code><@tag></code> header tags to create a jQuery UI <a href="@href">@title</a> widget.', $t_args) . '</li>';
}
$html .= '</ul>';
return $html;
}
else {
return '<p>' . $this
->t('You can create jQuery UI accordion or tabs by inserting <code>[accordion]</code> or <code>[tabs]</code> token wrappers.') . '</p>';
}
}