You are here

public function InsertView::tips in Insert View 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Filter/InsertView.php \Drupal\insert_view\Plugin\Filter\InsertView::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/InsertView.php, line 86

Class

InsertView
Provides a filter for insert view.

Namespace

Drupal\insert_view\Plugin\Filter

Code

public function tips($long = FALSE) {
  if ($long) {
    $output = '<br />';
    $output .= '<dl>';
    $output .= '<dt>' . t('Insert view filter allows to embed views using tags. The tag syntax is relatively simple: [view:name=display=args]') . '</dt>';
    $output .= '<dt>' . t('For example [view:tracker=page=1] says, embed a view named "tracker", use the "page" display, and supply the argument "1".') . '</dt>';
    $output .= '<dt>' . t("The <em>display</em> and <em>args</em> parameters can be omitted. If the display is left empty, the view\\'s default display is used.") . '</dt>';
    $output .= '<dt>' . t('Multiple arguments are separated with slash. The <em>args</em> format is the same as used in the URL (or view preview screen).') . '</dt>';
    $output .= '</dl>';
    $output .= t('Valid examples:');
    $output .= '<dl>';
    $output .= '<dt>[view:my_view]</dt>';
    $output .= '<dt>[view:my_view=my_display]</dt>';
    $output .= '<dt>[view:my_view=my_display=arg1/arg2/arg3]</dt>';
    $output .= '<dt>[view:my_view==arg1/arg2/arg3]</dt>';
    $output .= '</dl>';
    $output .= '<br />';
    return $output;
  }
  else {
    return t('You may use [view:<em>name=display=args</em>] tags to display views.');
  }
}