You are here

public function ButtonShortcode::tips in Shortcode 2.0.x

Same name and namespace in other branches
  1. 8 shortcode_basic_tags/src/Plugin/Shortcode/ButtonShortcode.php \Drupal\shortcode_basic_tags\Plugin\Shortcode\ButtonShortcode::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/ButtonShortcode.php, line 69

Class

ButtonShortcode
The image shortcode.

Namespace

Drupal\shortcode_basic_tags\Plugin\Shortcode

Code

public function tips($long = FALSE) {
  $output = [];
  $output[] = '<p><strong>' . $this
    ->t('[button path="path" (class="additional class")]text[/button]') . '</strong> ';
  if ($long) {
    $output[] = $this
      ->t('Inserts a link formatted like as a button. The <em>path</em> parameter provides the link target (the default is the front page).
    The <em>title</em> will be formatted as a link title (small tooltip over the link - helps for SEO).
    Additional class names can be added by the <em>class</em> parameter.') . '</p>';
  }
  else {
    $output[] = $this
      ->t('Inserts a link formatted as a button. Use the url parameter for the link.') . '</p>';
  }
  return implode(' ', $output);
}