customfilter.module in Custom filter 8
Same filename and directory in other branches
Allows the users with the right permission to define custom filters.
File
customfilter.moduleView source
<?php
/**
* @file
* Allows the users with the right permission to define custom filters.
*/
// Use the entity.
use Drupal\customfilter\Entity\CustomFilter;
/**
* Implements hook_filter_info_alter().
*
* This function add the filters from customfilter.
*/
function customfilter_filter_info_alter(&$info) {
$filters = CustomFilter::getFilters();
foreach ($filters as $filter) {
$id = 'customfilter_' . $filter
->id();
$info[$id]['description'] = $filter
->getDescription();
$info[$id]['weight'] = 0;
$info[$id]['status'] = FALSE;
$info[$id]['cache'] = $filter
->getCache();
$info[$id]['settings'] = array(
'id' => $filter
->id(),
);
$info[$id]['id'] = $id;
$info[$id]['module'] = 'customfilter';
$info[$id]['title'] = $filter
->label();
$info[$id]['type'] = 2;
$info[$id]['class'] = 'Drupal\\customfilter\\Plugin\\Filter\\CustomFilterBaseFilter';
$info[$id]['provider'] = 'customfilter';
}
}
Functions
Name | Description |
---|---|
customfilter_filter_info_alter | Implements hook_filter_info_alter(). |