You are here

public function InsertView::tips in Insert View 2.0.x

Same name and namespace in other branches
  1. 8 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 100

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>' . $this
      ->t('Insert view filter allows to embed views using tags. The tag syntax is relatively simple: [view:name=display=args=limit:number]') . '</dt>';
    $output .= '<dt>' . $this
      ->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>' . $this
      ->t("The <em>display</em>, <em>args</em>, and <em>limit</em> parameters can be omitted. If the display is left empty, the view\\'s default display is used. If the limit is left empty, the view display\\'s settings are used. Use <em>0</em> to show all results.") . '</dt>';
    $output .= '<dt>' . $this
      ->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 .= $this
      ->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=limit:number]</dt>';
    $output .= '<dt>[view:my_view==arg1/arg2/arg3]</dt>';
    $output .= '<dt>[view:my_view===limit:0]</dt>';
    $output .= '</dl>';
    $output .= '<br />';
    return $output;
  }
  else {
    return $this
      ->t('You may use [view:<em>name=display=args</em>] tags to display views.');
  }
}