You are here

filter_harmonizer.api.php in Views Filter Harmonizer 1.0.x

Same filename and directory in other branches
  1. 8 filter_harmonizer.api.php
  2. 7 filter_harmonizer.api.php

Documents hooks in the standard Drupal manner. This is not working code.

File

filter_harmonizer.api.php
View source
<?php

/**
 * @file
 * Documents hooks in the standard Drupal manner. This is not working code.
 */
use Drupal\views\Plugin\views\filter\FilterPluginBase;

/**
 * Allow modules to alter the meaning of 'is empty' for regular filter values.
 *
 * By default filter $value is considered empty when:
 * -- it is an empty array, or
 * -- when all of the array elements
 *    -- equal NULL or the empty string '' or an empty array, or
 *    -- are arrays with elements that equal NULL or '' or an empty array.
 *
 * Other modules may override this rule of thumb by implementing this hook.
 * Function does not return a value, but your hook implementation must set the
 * variable $is_empty.
 *
 * @param bool $is_empty
 *   Set this according to whether the $filter is considered empty or not.
 * @param Drupal\views\Plugin\views\filter\FilterPluginBase $filter
 *   The associated Views exposed filter handler, if needed.
 */
function hook_filter_harmonizer_is_empty(&$is_empty, FilterPluginBase $filter) {
}

/**
 * Takes a regular filter and outputs its filter value as a string.
 *
 * Example: GeofieldProximityFilter value may return "-37.8,144.9<=100km".
 *
 * @param Drupal\views\Plugin\views\filter\FilterPluginBase $regular_filter
 *   The regular filter handler containing an array of values.
 *
 * @return string
 *   The contextual argument string value.
 */
function hook_filter_harmonizer_stringify_regular_filter(FilterPluginBase $regular_filter) {
  return '';
}

/**
 * Takes a contextual filter arg and outputs it as form value(s).
 *
 * @param object $contextual_filter
 *   The contextual filter whose arg will be used to return regular filter form
 *   values.
 * @param Drupal\views\Plugin\views\filter\FilterPluginBase $regular_filter
 *   The regular filter handler.
 *
 * @return array
 *   An array of form values to populate the regular exposed filter form.
 */
function hook_filter_harmonizer_formalize_contextual_arg($contextual_filter, FilterPluginBase $regular_filter) {
  return [];
}

Functions

Namesort descending Description
hook_filter_harmonizer_formalize_contextual_arg Takes a contextual filter arg and outputs it as form value(s).
hook_filter_harmonizer_is_empty Allow modules to alter the meaning of 'is empty' for regular filter values.
hook_filter_harmonizer_stringify_regular_filter Takes a regular filter and outputs its filter value as a string.