W3cubDocs

/Drupal 8

function template_preprocess_filter_tips

template_preprocess_filter_tips(&$variables)

Prepares variables for filter tips templates.

Default template: filter-tips.html.twig.

Parameters

array $variables: An associative array containing:

  • tips: An array containing descriptions and a CSS ID in the form of 'module-name/filter-id' (only used when $long is TRUE) for each filter in one or more text formats. Example:
      array(
        'Full HTML' => array(
          0 => array(
            'tip' => 'Web page addresses and email addresses turn into links automatically.',
            'id' => 'filter/2',
          ),
        ),
      );
    
  • long: (optional) Whether the passed-in filter tips contain extended explanations, i.e. intended to be output on the path 'filter/tips' (TRUE), or are in a short format, i.e. suitable to be displayed below a form element. Defaults to FALSE.

File

core/modules/filter/filter.module, line 426
Framework for handling the filtering of content.

Code

function template_preprocess_filter_tips(&$variables) {
  $tips = $variables['tips'];

  foreach ($variables['tips'] as $name => $tiplist) {
    foreach ($tiplist as $tip_key => $tip) {
      $tiplist[$tip_key]['attributes'] = new Attribute();
    }

    $variables['tips'][$name] = array(
      'attributes' => new Attribute(),
      'name' => $name,
      'list' => $tiplist,
    );
  }

  $variables['multiple'] = count($tips) > 1;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!filter!filter.module/function/template_preprocess_filter_tips/8.1.x