You are here

class FilterController in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/filter/src/Controller/FilterController.php \Drupal\filter\Controller\FilterController

Controller routines for filter routes.

Hierarchy

Expanded class hierarchy of FilterController

File

core/modules/filter/src/Controller/FilterController.php, line 10

Namespace

Drupal\filter\Controller
View source
class FilterController {

  /**
   * Displays a page with long filter tips.
   *
   * @param \Drupal\filter\FilterFormatInterface|null $filter_format
   *   (optional) A filter format, or NULL to show tips for all formats.
   *   Defaults to NULL.
   *
   * @return array
   *   A renderable array.
   *
   * @see template_preprocess_filter_tips()
   */
  public function filterTips(FilterFormatInterface $filter_format = NULL) {
    $tips = $filter_format ? $filter_format
      ->id() : -1;
    $build = [
      '#theme' => 'filter_tips',
      '#long' => TRUE,
      '#tips' => _filter_tips($tips, TRUE),
    ];
    return $build;
  }

  /**
   * Gets the label of a filter format.
   *
   * @param \Drupal\filter\FilterFormatInterface $filter_format
   *   The filter format.
   *
   * @return string
   *   The label of the filter format.
   */
  public function getLabel(FilterFormatInterface $filter_format) {
    return $filter_format
      ->label();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FilterController::filterTips public function Displays a page with long filter tips.
FilterController::getLabel public function Gets the label of a filter format.