class flag_rules_data_type in Flag 6.2
Same name and namespace in other branches
- 6 includes/flag.rules.inc \flag_rules_data_type
Defines the flag rule data type.
Hierarchy
- class \rules_data_type
- class \flag_rules_data_type
Expanded class hierarchy of flag_rules_data_type
1 string reference to 'flag_rules_data_type'
- flag_rules_data_type_info in includes/
flag.rules.inc - Implementation of hook_rules_data_type_info().
File
- includes/
flag.rules.inc, line 29 - Rules integration for the Flag module.
View source
class flag_rules_data_type extends rules_data_type {
function save() {
$flag =& $this
->get();
$flag->save;
return TRUE;
}
function load($name) {
return flag_get_flag($name);
}
function get_identifier() {
$flag =& $this
->get();
return $flag->name;
}
/**
* Returns radios for selecting a flag of the type given in
* $info['flag_type'].
*/
function get_default_input_form($info, $value, &$form_state) {
$options = _flag_rules_flags_options(isset($info['flag_type']) ? $info['flag_type'] : NULL);
$form = array(
'#type' => 'radios',
'#title' => $info['label'],
'#options' => $options,
'#required' => TRUE,
'#disabled' => !$options,
'#default_value' => isset($value) ? $value : NULL,
'#theme' => 'flag_rules_radios',
'#printed' => TRUE,
);
if (!$options) {
$form['#description'] = t('Error: There is no suiting flag available.');
}
return $form;
}
function check_value($info, $value) {
if ($flag = flag_get_flag($value)) {
return $flag;
}
rules_log(t('The flag %name does not exist any more.', array(
'%name' => $value,
)));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
flag_rules_data_type:: |
function |
Checks the value of your data type. E.g. the number data type
uses this to make sure the value is a number. Overrides rules_data_type:: |
||
flag_rules_data_type:: |
function |
Returns radios for selecting a flag of the type given in
$info['flag_type']. Overrides rules_data_type:: |
||
flag_rules_data_type:: |
function |
Gets the identifier of this data, which can be of every php data type - even an array.
Implement it, if your data type is identifiable. Overrides rules_data_type:: |
||
flag_rules_data_type:: |
function |
Loads the data identified with an identifier as returned by get_identifier().
Just return the data or FALSE if loading the data failed. Overrides rules_data_type:: |
||
flag_rules_data_type:: |
function |
Makes changes to the data permanent.
Implement it, if your data type is savable. Overrides rules_data_type:: |
||
rules_data_type:: |
property | |||
rules_data_type:: |
property | |||
rules_data_type:: |
property | |||
rules_data_type:: |
function | Constructor | ||
rules_data_type:: |
function | Returns whether the input evaluator should be used for this data | ||
rules_data_type:: |
function | Gets the data | ||
rules_data_type:: |
function | Gets the information about this data type. | ||
rules_data_type:: |
function | Inititate the data | ||
rules_data_type:: |
function | Returns whether this data is identifiable | ||
rules_data_type:: |
function | Returns whether this data is savable | ||
rules_data_type:: |
function | Replaces the data with the new one | ||
rules_data_type:: |
function | Returns whether this data makes use of an input form for creating an instance on the fly. |