You are here

public function DropcapShortcode::tips in Shortcode 2.0.x

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

Class

DropcapShortcode
Replace the given text formatted like as a dropcap.

Namespace

Drupal\shortcode_basic_tags\Plugin\Shortcode

Code

public function tips($long = FALSE) {
  $output = [];
  $output[] = '<p><strong>' . $this
    ->t('[dropcap (class="additional class")]text[/dropcap]') . '</strong> ';
  if ($long) {
    $output[] = $this
      ->t('Makes dropcap from the text.') . '</p>';
    $output[] = '<p>' . $this
      ->t('Sample css:') . '</p>';
    $output[] = '<code>
        .dropcap {
          display:block;
          float:left;
          font-size:38px;
          line-height:38px;
          vertical-align:baseline;
          padding-right:5px;
        }
        </code><p></p>';
  }
  else {
    $output[] = $this
      ->t('Makes dropcap from the text. Additional class names can be added by the <em>class</em> parameter.') . '</p>';
  }
  return implode(' ', $output);
}