You are here

public function BootstrapColumnShortcode::tips in Shortcode 2.0.x

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

Class

BootstrapColumnShortcode
Provides a shortcode for bootstrap columns.

Namespace

Drupal\shortcode_example\Plugin\Shortcode

Code

public function tips($long = FALSE) {
  $output = [];
  $output[] = '<p><strong>' . $this
    ->t('[col class="custom-class" xs="12" sm="6" md="4" lg="3"]Other HTML content here [/col]') . '</strong> ';
  if ($long) {
    $output[] = $this
      ->t('Wraps your content with a div with bootstrap column size classes. All attributes are optional but it would not be very useful unless you define at least 1 size attribute or custom all the classes yourself using class. Setting md=4 translates to the col-md-4 class, etc.') . '</p>';
  }
  else {
    $output[] = $this
      ->t('Wraps your content with a div with bootstrap column size classes.') . '</p>';
  }
  return implode(' ', $output);
}