You are here

public function ItemShortcode::tips in Shortcode 2.0.x

Same name and namespace in other branches
  1. 8 shortcode_basic_tags/src/Plugin/Shortcode/ItemShortcode.php \Drupal\shortcode_basic_tags\Plugin\Shortcode\ItemShortcode::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 ShortcodeBase::tips

File

shortcode_basic_tags/src/Plugin/Shortcode/ItemShortcode.php, line 72

Class

ItemShortcode
Insert div or span around the text with some css classes.

Namespace

Drupal\shortcode_basic_tags\Plugin\Shortcode

Code

public function tips($long = FALSE) {
  $output = [];
  $output[] = '<p><strong>' . $this
    ->t('[item (class="additional class"|id=item id|type=div,d,span,s)]text[/item]') . '</strong> ';
  if ($long) {
    $output[] = $this
      ->t('Inserts an html item (type parameter = div or span) around the given text.') . '</p>';
    $output[] = '<p>' . $this
      ->t('Additional class names can be added by the <em>class</em> parameter. The id parameter gives the html an unique css id.') . '</p>';
  }
  else {
    $output[] = $this
      ->t('Inserts an html item (div or span) around the given text.') . '</p>';
  }
  return implode(' ', $output);
}