finder_condition_args
- finder
| Versions | |
|---|---|
| 7.x-1.x | finder_condition_args($field = NULL, $value = NULL, $match = NULL) |
Get data about finder match methods.
Parameters
$field The field to match.
$value The value to match.
$match The match method according to finder's settings.
Return value
An object cast from an array with keys field/value/match if $match is set. Otherwise returns the full array of data about all match methods including operators and descriptions.
Code
./
<?php
function finder_condition_args($field = NULL, $value = NULL, $match = NULL) {
static $operators;
if (empty($operators)) {
// Operators use abbreviated key names because they need to be tiny in cache ID's.
$operators = finder_condition_args_default();
$operators = array_merge($operators, variable_get('finder_custom_matching', array()));
drupal_alter('finder_condition_args', $operators);
}
if (!is_null($match)) {
if ($operators[$match]['value_prefix']) {
$value = $operators[$match]['value_prefix'] . $value;
}
if ($operators[$match]['value_suffix']) {
$value = $value . $operators[$match]['value_suffix'];
}
return (object) array('field' => $field, 'value' => $value, 'match' => $operators[$match]['operator']);
}
return $operators;
}
?>
