You are here

function finder_condition_args in Finder 7

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.

5 calls to finder_condition_args()
finder_admin_element_edit in includes/finder.admin.inc
Admin finder element add/edit page. Must have a Finder object at this point.
finder_autocomplete_form_finder_admin_element_edit_alter in modules/finder_autocomplete/finder_autocomplete.module
Implements hook_form_FORM_ID_alter().
finder_find_choices in ./finder.module
Postprocessing for returned finder_find options when mode is choices.
finder_find_query in ./finder.module
Build basic finder query arrays.
finder_views_plugin_display_finder::query in modules/finder_views/includes/finder_views_plugin_display_finder.inc
Inject anything into the query that the display handler needs.

File

./finder.module, line 1238
The finder module.

Code

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;
}