class FlagRulesDataWrapper in Flag 7.2
Same name and namespace in other branches
- 7.3 flag.rules.inc \FlagRulesDataWrapper
A custom wrapper class for flags to be used with Rules.
Hierarchy
- class \EntityMetadataWrapper
- class \EntityStructureWrapper implements \IteratorAggregate
- class \RulesIdentifiableDataWrapper
- class \FlagRulesDataWrapper implements RulesDataWrapperSavableInterface
- class \RulesIdentifiableDataWrapper
- class \EntityStructureWrapper implements \IteratorAggregate
Expanded class hierarchy of FlagRulesDataWrapper
1 string reference to 'FlagRulesDataWrapper'
- flag_rules_data_info in ./
flag.rules.inc - Implements hook_rules_data_info().
File
- ./
flag.rules.inc, line 27 - Rules integration for the Flag module.
View source
class FlagRulesDataWrapper extends RulesIdentifiableDataWrapper implements RulesDataWrapperSavableInterface {
protected function extractIdentifier($flag) {
return $flag->name;
}
protected function load($name) {
return flag_get_flag($name);
}
public function save() {
$flag = $this
->value();
$flag
->save();
}
public function validate($value) {
if (isset($value) && is_string($value)) {
return TRUE;
}
elseif (isset($value) && is_object($value) && $value instanceof flag_flag) {
return TRUE;
}
return parent::validate($value);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityMetadataWrapper:: |
protected | property | ||
EntityMetadataWrapper:: |
protected | property | ||
EntityMetadataWrapper:: |
protected | property | ||
EntityMetadataWrapper:: |
protected | property | 1 | |
EntityMetadataWrapper:: |
public | function | Determines whether the given user has access to view or edit this property. Apart from relying on access metadata of properties, this takes into account information about entity level access, if available: | 1 |
EntityMetadataWrapper:: |
protected | function | Returns whether data is available to work with. | |
EntityMetadataWrapper:: |
public | function | Returns a string to use to identify this wrapper in error messages. | 1 |
EntityMetadataWrapper:: |
public | function | Gets info about the wrapped data. | |
EntityMetadataWrapper:: |
public | function | Returns the label for the currently set property value if there is one available, i.e. if an options list has been specified. | 2 |
EntityMetadataWrapper:: |
public | function | Returns the options list specifying possible values for the property, if defined. | |
EntityMetadataWrapper:: |
public | function | Returns the raw, unprocessed data. Most times this is the same as returned by value(), however for already processed and sanitized textual data, this will return the unprocessed data in contrast to value(). | |
EntityMetadataWrapper:: |
public | function | Gets the (entity)type of the wrapped data. | 1 |
EntityMetadataWrapper:: |
protected | function | Updates the parent data structure of a data property with the latest data value. | |
EntityMetadataWrapper:: |
public | function | ||
EntityStructureWrapper:: |
protected | property | ||
EntityStructureWrapper:: |
protected | property | ||
EntityStructureWrapper:: |
protected | property | ||
EntityStructureWrapper:: |
public | function | Get the wrapper for a property. | |
EntityStructureWrapper:: |
public | function | ||
EntityStructureWrapper:: |
public | function | Gets the info about the given property. | |
EntityStructureWrapper:: |
public | function | Gets the language used for retrieving properties. | |
EntityStructureWrapper:: |
protected | function | Gets the raw value of a property. | |
EntityStructureWrapper:: |
protected | function | Gets the value of a property. | |
EntityStructureWrapper:: |
public | function | Sets a new language to use for retrieving properties. | |
EntityStructureWrapper:: |
protected | function | ||
EntityStructureWrapper:: |
public | function | Returns a reference on the property info. | |
EntityStructureWrapper:: |
protected | function | Sets a property. | |
EntityStructureWrapper:: |
protected | function | May be used to lazy-load additional info about the data, depending on the concrete passed data. | 1 |
EntityStructureWrapper:: |
public | function | Magic method: Get a wrapper for a property. | |
EntityStructureWrapper:: |
public | function | Magic method: Can be used to check if a property is known. | |
EntityStructureWrapper:: |
public | function | Magic method: Set a property. | |
FlagRulesDataWrapper:: |
protected | function |
Extract the identifier of the given data object. Overrides RulesIdentifiableDataWrapper:: |
|
FlagRulesDataWrapper:: |
protected | function |
Load a data object given an identifier. Overrides RulesIdentifiableDataWrapper:: |
|
FlagRulesDataWrapper:: |
public | function |
Save the currently wrapped data. Overrides RulesDataWrapperSavableInterface:: |
|
FlagRulesDataWrapper:: |
public | function |
Returns whether $value is a valid value to set. Overrides EntityMetadataWrapper:: |
|
RulesIdentifiableDataWrapper:: |
protected | property | Contains the id. | |
RulesIdentifiableDataWrapper:: |
public | function |
Overridden. Overrides EntityStructureWrapper:: |
|
RulesIdentifiableDataWrapper:: |
public | function |
Returns the identifier of the wrapped data. Overrides EntityStructureWrapper:: |
|
RulesIdentifiableDataWrapper:: |
public | function |
Overridden to support setting the data by either the object or the id. Overrides EntityMetadataWrapper:: |
|
RulesIdentifiableDataWrapper:: |
protected | function | Sets the data internally accepting both the data id and object. | |
RulesIdentifiableDataWrapper:: |
public | function |
Overridden. Overrides EntityMetadataWrapper:: |
|
RulesIdentifiableDataWrapper:: |
public | function |
Construct a new wrapper object. Overrides EntityStructureWrapper:: |
|
RulesIdentifiableDataWrapper:: |
public | function |
Prepare for serialization. Overrides EntityStructureWrapper:: |
|
RulesIdentifiableDataWrapper:: |
public | function | Prepare for unserialization. |