Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / filter / src / Controller / FilterController.php
1 <?php
2
3 namespace Drupal\filter\Controller;
4
5 use Drupal\filter\FilterFormatInterface;
6
7 /**
8  * Controller routines for filter routes.
9  */
10 class FilterController {
11
12   /**
13    * Displays a page with long filter tips.
14    *
15    * @param \Drupal\filter\FilterFormatInterface|null $filter_format
16    *   (optional) A filter format, or NULL to show tips for all formats.
17    *   Defaults to NULL.
18    *
19    * @return array
20    *   A renderable array.
21    *
22    * @see template_preprocess_filter_tips()
23    */
24   public function filterTips(FilterFormatInterface $filter_format = NULL) {
25     $tips = $filter_format ? $filter_format->id() : -1;
26
27     $build = [
28       '#theme' => 'filter_tips',
29       '#long' => TRUE,
30       '#tips' => _filter_tips($tips, TRUE),
31     ];
32
33     return $build;
34   }
35
36   /**
37    * Gets the label of a filter format.
38    *
39    * @param \Drupal\filter\FilterFormatInterface $filter_format
40    *   The filter format.
41    *
42    * @return string
43    *   The label of the filter format.
44    */
45   public function getLabel(FilterFormatInterface $filter_format) {
46     return $filter_format->label();
47   }
48
49 }