function fasttoggle_get_object_value in Fasttoggle 7
Get a value from an object.
Get the value of an object's attribute. There are three options:
- A group specific function
- An attribute of the object with the name overridden at instance level
- $object->$instance without modification.
Parameters
array $options: An array containing the configuration data for the object type.
string $group: A string, containing the group to which the attribute belongs.
string $instance: The name of the attribute being accessed (string).
object $object: An instance of the object containing the value to be returned.
Return value
mixed The value of the attribute.
2 calls to fasttoggle_get_object_value()
- fasttoggle in ./
fasttoggle.module - Add fasttoggle abilities to a link.
- fasttoggle_do_toggle_option in ./
fasttoggle.module - Handle a request to toggle an option.
File
- ./
fasttoggle.module, line 112 - Enables fast toggling of binary or not so binary settings.
Code
function fasttoggle_get_object_value(array $options, $group, $instance, $object) {
if (isset($options['fields'][$group]['value_fn'])) {
return $options['fields'][$group]['value_fn']($options, $group, $instance, $object);
}
else {
if (isset($options['fields'][$group]['instances'][$instance]['value_key'])) {
return $object->{$options['fields'][$group]['instances'][$instance]['value_key']};
}
else {
return $object->{$instance};
}
}
}