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;
}
doc_Drupal
2016-10-29 09:46:41
Comments
Leave a Comment

Please login to continue.