You are here

function entity_entity_property_info in Entity API 7

Implements hook_entity_property_info().


./, line 13
Provides basic entity property info for entities provided via the CRUD API, as well as property info for all entity types defined by core. For that the respective modules/ files are included.


function entity_entity_property_info() {
  $items = array();

  // Add in info about entities provided by the CRUD API.
  foreach (entity_crud_get_info() as $type => $info) {

    // Automatically enable the controller only if the module does not implement
    // the hook itself.
    if (!isset($info['metadata controller class']) && !empty($info['base table']) && (!isset($info['module']) || !module_hook($info['module'], 'entity_property_info'))) {
      $info['metadata controller class'] = 'EntityDefaultMetadataController';
    if (!empty($info['metadata controller class'])) {
      $controller = new $info['metadata controller class']($type);
      $items += $controller

  // Add in info for all core entities.
  foreach (_entity_metadata_core_modules() as $module) {
    module_load_include('inc', 'entity', "modules/{$module}.info");
    if (function_exists($function = "entity_metadata_{$module}_entity_property_info")) {
      if ($return = $function()) {
        $items = array_merge_recursive($items, $return);
  return $items;