You are here

function finder::match_args in Finder 7.2

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.

$match_x: The custom match method, if available.

Return value

An object cast from an array with keys field/value/match if $match is set.

1 call to finder::match_args()
finder::choice_find in includes/finder.inc
Finder choice find.

File

includes/finder.inc, line 1244
finder.inc

Class

finder
An object to contain all of the data to generate a finder, plus the member functions to build the finder, and render the output.

Code

function match_args($field, $value, $match, $match_x = NULL) {
  $matches = $this
    ->matches();
  if ($match_x) {
    $matches['x'] = $match_x;
  }
  if ($matches[$match]['value_prefix']) {
    if (strpos($matches[$match]['operator'], 'LIKE') !== FALSE) {
      $value = db_like($value);
    }
    $value = $matches[$match]['value_prefix'] . $value;
  }
  if ($matches[$match]['value_suffix']) {
    $value = $value . $matches[$match]['value_suffix'];
  }
  return (object) array(
    'field' => $field,
    'value' => $value,
    'match' => $matches[$match]['operator'],
  );
}