You are here

public function FilterAmazon::tips in Amazon Product Advertisement API 8.2

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

modules/amazon_filter/src/Plugin/Filter/FilterAmazon.php, line 135
Contains \Drupal\amazon_filter\Plugin\Filter\FilterAmazon.

Class

FilterAmazon
Provides a filter to easily be links to Amazon using an Associate ID.

Namespace

Drupal\amazon_filter\Plugin\Filter

Code

public function tips($long = FALSE) {
  $output = $this
    ->t('Link to Amazon products with [amazon:ASIN:display_type(:cache_max_age_in_seconds)]. Example: [amazon:1590597559:thumbnail:900] or [amazon:1590597559:author]. Details are <a href=":url" target="_blank">on the Amazon module handbook page</a>.', [
    ':url' => 'http://drupal.org/node/595464#filters',
  ]);
  if (!$long) {
    return $output;
  }
  $output = '<p>' . $output . '</p>';
  $output .= '<p>' . $this
    ->t('Currently supported options for display_typ:') . '</p>';
  $output .= '<ul><li>' . $this
    ->t('inline: Creates a text link to Amazon using the product title') . '</li>';
  $output .= '<li>' . $this
    ->t('thumbnail|small: Creates a link to Amazon using the small image size') . '</li>';
  $output .= '<li>' . $this
    ->t('medium: Creates a link to Amazon using the medium image size') . '</li>';
  $output .= '<li>' . $this
    ->t('full|large: Creates a link to Amazon using the large image size') . '</li>';

  //$output .= '<li>' . $this->t() . '</li>';

  //$output .= '<li>' . $this->t() . '</li>';

  //$output .= '<li>' . $this->t() . '</li>';

  //$output .= '<li>' . $this->t() . '</li>';
  $output .= '<li>' . $this
    ->t() . '</li></ul>';
  return $output;
}