function rules_get_components

Returns an array of configured components.

For actually executing a component use rules_invoke_component(), as this retrieves the component from cache instead.

Parameters

$label: Whether to return only the label or the whole component object.

$type: Optionally filter for 'action' or 'condition' components.

array $conditions: An array of additional conditions as required by rules_config_load().

Return value

array An array keyed by component name containing either the label or the config.

5 calls to rules_get_components()
rules_rules_core_action_info in modules/rules_core.rules.inc
Implements hook_rules_action_info() on behalf of the pseudo rules_core module.
rules_rules_core_condition_info in modules/rules_core.rules.inc
Implements hook_rules_condition_info() on behalf of the pseudo rules_core module.
rules_scheduler_component_options_list in rules_scheduler/rules_scheduler.rules.inc
Options list callback returning a list of action components.
rules_scheduler_form in rules_scheduler/rules_scheduler.admin.inc
Form for deletion of tasks by component.
_rules_rebuild_component_cache in ./rules.module
Cache components to allow efficient usage via rules_invoke_component().

File

./rules.module, line 954

Code

function rules_get_components($label = FALSE, $type = NULL, $conditions = array()) {
    $cache = rules_get_cache();
    $plugins = array_keys(rules_filter_array($cache['plugin_info'], 'component', TRUE));
    $conditions = $conditions + array(
        'plugin' => $plugins,
    );
    $faces = array(
        'action' => 'RulesActionInterface',
        'condition' => 'RulesConditionInterface',
    );
    $items = array();
    foreach (rules_config_load_multiple(FALSE, $conditions) as $name => $config) {
        if (!isset($type) || $config instanceof $faces[$type]) {
            $items[$name] = $label ? $config->label() : $config;
        }
    }
    return $items;
}