function entity_property_options_flatten in Entity API 7
Flattens the given options in single dimensional array. We don't depend on options module, so we cannot use options_array_flatten().
See also
3 calls to entity_property_options_flatten()
- EntityListWrapper::label in includes/
entity.wrapper.inc - Returns the label for the list of set values if available.
- EntityMetadataIntegrationTestCase::createValue in ./
entity.test - Creates a value for the given property.
- EntityMetadataWrapper::label in includes/
entity.wrapper.inc - Returns the label for the currently set property value if there is one available, i.e. if an options list has been specified.
File
- includes/
entity.property.inc, line 482 - Provides API functions around hook_entity_property_info(). Also see entity.info.inc, which cares for providing entity property info for all core entity types.
Code
function entity_property_options_flatten($options) {
$result = array();
foreach ($options as $key => $value) {
if (is_array($value)) {
$result += $value;
}
else {
$result[$key] = $value;
}
}
return $result;
}