class RulesFormsAttributeWrapper in Rules Forms Support 7.2
Wrapper class for form element attributes.
Hierarchy
- class \EntityMetadataWrapper
- class \EntityValueWrapper
- class \RulesFormsAttributeWrapper
- class \EntityValueWrapper
Expanded class hierarchy of RulesFormsAttributeWrapper
File
- includes/
rules_forms.wrapper.inc, line 253 - Manages and Process Form structure.
View source
class RulesFormsAttributeWrapper extends EntityValueWrapper {
/**
* Magic method: Retrieve data from parent form element.
*
* This is done by calling getElement methods directly. Setter methods are not
* supported.
*/
public function __call($method, array $args) {
if (substr($method, 0, 10) === 'getElement' && method_exists($this->info['parent'], $method)) {
return call_user_func_array(array(
$this->info['parent'],
$method,
), $args);
}
}
/**
* Overrides EntityMetadataWrapper::set() to handle special circumstances.
*/
public function set($value) {
// The #options attribute is identified in property info as 'text' property
// in order to provide the proper interface. However, that text is converted
// to an array, so if this is an #options attribute we check to ensure that
// we're either receiving text or an array.
if ($this->info['name'] == '#options') {
if (!is_string($value) && !is_array($value)) {
throw new EntityMetadataWrapperException('Invalid data value given. Be sure it matches the required data type and format.');
}
}
elseif (!$this
->validate($value)) {
throw new EntityMetadataWrapperException('Invalid data value given. Be sure it matches the required data type and format.');
}
$this
->clear();
$this->data = $value;
$this
->updateParent($value);
return $this;
}
}
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 | Clears the data value and the wrapper cache. | 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 | Returns whether $value is a valid value to set. | 1 |
EntityMetadataWrapper:: |
public | function | Construct a new wrapper object. | 2 |
EntityMetadataWrapper:: |
public | function | Prepare for serializiation. | 1 |
EntityMetadataWrapper:: |
public | function | ||
EntityValueWrapper:: |
public | function |
Overrides EntityMetadataWrapper#value().
Sanitizes or decode textual data if necessary. Overrides EntityMetadataWrapper:: |
|
RulesFormsAttributeWrapper:: |
public | function |
Overrides EntityMetadataWrapper::set() to handle special circumstances. Overrides EntityMetadataWrapper:: |
|
RulesFormsAttributeWrapper:: |
public | function | Magic method: Retrieve data from parent form element. |