You are here

function restful_test_entity_property_info_alter in RESTful 7.2

Implements hook_entity_property_info_alter().

File

tests/modules/restful_test/restful_test.module, line 475
Helper module for testing the RESTful module.

Code

function restful_test_entity_property_info_alter(&$info) {
  $entity_types = array(
    'entity_test',
    'restful_test_translatable_entity',
  );
  foreach ($entity_types as $entity_type) {
    $entity_info = entity_get_info($entity_type);
    if (isset($entity_info['uuid']) && $entity_info['uuid'] == TRUE && !empty($entity_info['entity keys']['uuid']) && empty($info[$entity_type]['properties'][$entity_info['entity keys']['uuid']])) {
      $info[$entity_type]['properties'][$entity_info['entity keys']['uuid']] = array(
        'label' => t('UUID'),
        'type' => 'text',
        'description' => t('The universally unique ID.'),
        'schema field' => $entity_info['entity keys']['uuid'],
      );
      if (!empty($entity_info['entity keys']['revision uuid']) && empty($info[$entity_type]['properties'][$entity_info['entity keys']['revision uuid']])) {
        $info[$entity_type]['properties'][$entity_info['entity keys']['revision uuid']] = array(
          'label' => t('Revision UUID'),
          'type' => 'text',
          'description' => t("The revision's universally unique ID."),
          'schema field' => $entity_info['entity keys']['revision uuid'],
        );
      }
    }
  }
}