function feeds_rules_get_rules_component_params in Feeds Rules 7
Helper to get selectable parameters for a rules component.
Parameters
string $component_name: Component nachine name without 'comp_' prefix.
array $usage_types: (optional) restrict to specific usage types: 'params' or 'provided'.
array $property_types: (optional) list of rules data property types, that shall be returned, e.g. 'text', 'node', ...
Return value
array Array of key value pairs: e.g. 'params:name' => 'Parameter: Name (text)' for usage in an options list.
1 call to feeds_rules_get_rules_component_params()
- FeedsRulesProcessor::configForm in plugins/
FeedsRulesProcessor.inc - As we do not process any entities directly, we only provide configuration on what rule set/action shall be used.
File
- ./
feeds_rules.module, line 115 - Feeds rules module provides different rules implementations for feeds:
Code
function feeds_rules_get_rules_component_params($component_name, $usage_types = array(), $property_types = array()) {
// Provide parameters and provided variables, as values for the target
// "reverse" component.
$action = rules_get_cache('comp_' . $component_name);
// Return nothing if component has not been loaded (not configured yet or component disappeared)
if (!$action) {
return array();
}
$run = array();
// Add parameters to the options list.
if (empty($usage_types) || in_array('params', $usage_types)) {
$run['params'] = $action
->parameterInfo();
}
// Provided parameters to the list.
if (empty($usage_types) || in_array('provided', $usage_types)) {
$run['provided'] = $action
->providesVariables();
}
// Human readable labels.
$labels = array(
'params' => t('Parameter'),
'provided' => t('Provided'),
);
// Build the options array for the applicable sources.
$sources = array();
foreach ($run as $usage_type => $spec) {
foreach ($spec as $key => $info) {
// Skip the property, if it is not of the specified property types.
if (!empty($property_types) && !in_array($info['type'], $property_types)) {
continue;
}
$sources["{$usage_type}::{$key}"] = format_string('@usage_type: @label (@value_type)', array(
'@usage_type' => $labels[$usage_type],
'@label' => $info['label'],
'@value_type' => $info['type'],
));
}
}
return $sources;
}