You are here

public function FilterTwig::tips in Filter Twig 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Filter/FilterTwig.php \Drupal\filter_twig\Plugin\Filter\FilterTwig::tips()

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/FilterTwig.php, line 77

Class

FilterTwig
Provides a filter that replaces twig values.

Namespace

Drupal\filter_twig\Plugin\Filter

Code

public function tips($long = FALSE) : MarkupInterface {
  $build = [
    '#markup' => $this
      ->t('Allowed Twig syntax. <a href="@doc" target="_blank">See documentation how to use it</a>', [
      '@doc' => 'https://www.drupal.org/node/1918824',
    ]),
  ];
  return $this->renderer
    ->render($build);
}