function RulesPlugin::exportParameterSetting

1 call to RulesPlugin::exportParameterSetting()
RulesPlugin::exportSettings in includes/rules.core.inc

File

includes/rules.core.inc, line 1428

Class

RulesPlugin
Base class for rules plugins.

Code

protected function exportParameterSetting($name, $info) {
    if (isset($this->settings[$name]) && (empty($info['optional']) || !isset($info['default value']) || $this->settings[$name] != $info['default value'])) {
        // In case of an array-value wrap the value into another array, such that
        // the value cannot be confused with an exported data selector.
        return is_array($this->settings[$name]) ? array(
            'value' => $this->settings[$name],
        ) : $this->settings[$name];
    }
    elseif (isset($this->settings[$name . ':select'])) {
        if (isset($this->settings[$name . ':process']) && ($processor = $this->settings[$name . ':process'])) {
            $export['select'] = $this->settings[$name . ':select'];
            $export += $processor instanceof RulesDataProcessor ? $processor->getChainSettings() : $processor;
            return $export;
        }
        // If there is no processor use a simple array to abbreviate this usual
        // case. In JSON this turns to a nice [selector] string.
        return array(
            $this->settings[$name . ':select'],
        );
    }
}