class RulesNumericOffsetProcessor
A data processor for applying numerical offsets.
Hierarchy
- class \RulesDataProcessor
- class \RulesNumericOffsetProcessor extends \RulesDataProcessor
Expanded class hierarchy of RulesNumericOffsetProcessor
Related topics
1 string reference to 'RulesNumericOffsetProcessor'
- rules_rules_core_data_processor_info in modules/
rules_core.rules.inc - Implements hook_rules_data_processor_info() on behalf of the pseudo rules_core module.
File
-
modules/
rules_core.eval.inc, line 213
View source
class RulesNumericOffsetProcessor extends RulesDataProcessor {
/**
* Overrides RulesDataProcessor::form().
*/
protected static function form($settings, $var_info) {
$settings += array(
'value' => '',
);
$form = array(
'#type' => 'fieldset',
'#title' => t('Add offset'),
'#collapsible' => TRUE,
'#collapsed' => empty($settings['value']),
'#description' => t('Add an offset to the selected number. E.g. an offset of "1" adds 1 to the number before it is passed on as argument.'),
);
$form['value'] = array(
'#type' => 'textfield',
'#title' => t('Offset'),
'#description' => t('Note that you can also specify negative numbers.'),
'#default_value' => $settings['value'],
'#element_validate' => array(
'rules_ui_element_integer_validate',
),
'#weight' => 5,
);
return $form;
}
/**
* Overrides RulesDataProcessor::process().
*/
public function process($value, $info, RulesState $state, RulesPlugin $element) {
$value = isset($this->processor) ? $this->processor
->process($value, $info, $state, $element) : $value;
return $value + $this->setting['value'];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
RulesDataProcessor::$processor | protected | property | Allows chaining processors. If set, the next processor to invoke. | ||
RulesDataProcessor::$setting | protected | property | The processors' setting value. | ||
RulesDataProcessor::access | public static | function | Return whether the current user has permission to use the processor. | 1 | |
RulesDataProcessor::attachForm | public static | function | Attaches the form of applicable data processors. | 1 | |
RulesDataProcessor::dependencies | public | function | Returns an array of modules which we depend on. | ||
RulesDataProcessor::editAccess | public | function | Determines whether the current user has permission to edit this chain of data processors. |
2 | |
RulesDataProcessor::getChainSettings | public | function | Gets the settings array for this and all contained chained processors. | ||
RulesDataProcessor::getPreparedValue | protected | function | Return $this or skip this processor by returning the next processor. | 1 | |
RulesDataProcessor::getSetting | public | function | Gets the settings of this processor. | ||
RulesDataProcessor::prepareSetting | public static | function | Prepares the processor for parameters. | 1 | |
RulesDataProcessor::processors | public static | function | Returns defined data processors applicable for the given parameter. | 1 | |
RulesDataProcessor::unchain | protected | function | |||
RulesDataProcessor::_item_sort | public static | function | |||
RulesDataProcessor::__construct | protected | function | Constructor. | 1 | |
RulesNumericOffsetProcessor::form | protected static | function | Overrides RulesDataProcessor::form(). | Overrides RulesDataProcessor::form | |
RulesNumericOffsetProcessor::process | public | function | Overrides RulesDataProcessor::process(). | Overrides RulesDataProcessor::process |