function eck_entity_property_info in Entity Construction Kit (ECK) 7.2
Same name and namespace in other branches
- 7.3 eck.module \eck_entity_property_info()
Implements hook_entity_property_info().
File
- ./
eck.module, line 379
Code
function eck_entity_property_info() {
module_load_include('inc', 'entity', 'entity.info');
$info = array();
foreach (EntityType::loadAll() as $entity_type) {
$properties = $entity_type->properties;
$stuff = entity_metadata_convert_schema("eck_{$entity_type->name}");
foreach ($stuff as $key => $property) {
// Use user defined label for property.
if (isset($properties[$key])) {
$property['label'] = $properties[$key]['label'];
}
$property['setter callback'] = "entity_property_verbatim_set";
$property['getter callback'] = 'entity_property_verbatim_get';
$property['description'] = $property['label'];
// A couple of alter hooks so a module can alter the property info
// of a given property, or even a specific property on a
// specific entity_type.
drupal_alter("entity_property_{$key}_info", $property);
drupal_alter("entity_property_{$entity_type->name}_{$key}_info", $property);
if ($key == 'type') {
$property['label'] = t('!entity_type type', array(
'!entity_type' => $entity_type->name,
));
$property['type'] = 'token';
$property['description'] = t('The type of this :entity_type entity.', array(
':entity_type' => $entity_type->name,
));
$property['options list'] = 'EntityDefaultMetadataController::bundleOptionsList';
$property['required'] = TRUE;
}
$stuff[$key] = $property;
}
$info[$entity_type->name]['properties'] = $stuff;
}
return $info;
}