You are here

public static function RulesDataProcessor::processors in Rules 7.2

Returns defined data processors applicable for the given parameter.

Optionally also checks access to the processors.

Parameters

$param_info: If given, only processors valid for this parameter are returned.

bool $access_check:

string $hook:

6 calls to RulesDataProcessor::processors()
RulesDataInputEvaluator::evaluators in includes/rules.processor.inc
Returns all input evaluators that can be applied to the parameters type.
RulesDataInputEvaluator::processors in includes/rules.processor.inc
Overrides RulesDataProcessor::processors().
RulesDataProcessor::attachForm in includes/rules.processor.inc
Attaches the form of applicable data processors.
RulesDataProcessor::dependencies in includes/rules.processor.inc
Returns an array of modules which we depend on.
RulesDataProcessor::prepareSetting in includes/rules.processor.inc
Prepares the processor for parameters.

... See full list

1 method overrides RulesDataProcessor::processors()
RulesDataInputEvaluator::processors in includes/rules.processor.inc
Overrides RulesDataProcessor::processors().

File

includes/rules.processor.inc, line 103
Contains classes for data processing.

Class

RulesDataProcessor
Common base class for Rules data processors.

Code

public static function processors($param_info = NULL, $access_check = TRUE, $hook = 'data_processor_info') {
  static $items = array();
  if (!isset($items[$hook]['all'])) {
    $items[$hook]['all'] = rules_fetch_data($hook);
    if (isset($items[$hook]['all'])) {
      uasort($items[$hook]['all'], array(
        __CLASS__,
        '_item_sort',
      ));
    }
  }

  // Data processing isn't supported for multiple types.
  if (isset($param_info) && is_array($param_info['type'])) {
    return array();
  }

  // Filter the items by type.
  if (isset($param_info['type']) && !isset($items[$hook][$param_info['type']])) {
    $items[$hook][$param_info['type']] = array();
    foreach ($items[$hook]['all'] as $name => $info) {

      // Check whether the parameter type matches the supported types.
      $info += array(
        'type' => 'text',
      );
      if (RulesData::typesMatch($param_info, $info, FALSE)) {
        $items[$hook][$param_info['type']][$name] = $info;
      }
    }
  }

  // Apply the access check.
  $return = isset($param_info['type']) ? $items[$hook][$param_info['type']] : $items[$hook]['all'];
  if ($access_check) {
    foreach ($return as $base => $info) {
      if (!call_user_func(array(
        $info['class'],
        'access',
      ))) {
        unset($return[$base]);
      }
    }
  }
  return $return;
}