You are here

function farm_movement_entity_property_info_alter in farmOS 7

Implements hook_entity_property_info_alter().

File

modules/farm/farm_movement/farm_movement.module, line 16
Farm movement.

Code

function farm_movement_entity_property_info_alter(&$info) {

  // Add a location property to assets.
  $info['farm_asset']['properties']['location'] = array(
    'type' => 'list<taxonomy_term>',
    'label' => t('Asset location'),
    'description' => t('The area(s) where the asset is currently located.'),
    'getter callback' => 'farm_movement_asset_location_property_get',
    'computed' => TRUE,
  );

  // Add a geometry property to assets.
  $info['farm_asset']['properties']['geometry'] = array(
    'type' => 'text',
    'label' => t('Asset geometry'),
    'description' => t('The current geometry of the asset'),
    'getter callback' => 'farm_movement_asset_geometry_property_get',
    'computed' => TRUE,
  );

  // Add an assets property to areas.
  $info['taxonomy_term']['bundles']['farm_areas']['properties']['assets'] = array(
    'type' => 'list<farm_asset>',
    'label' => t('Assets in area'),
    'description' => t('A list of assets currently located in the area.'),
    'getter callback' => 'farm_movement_area_assets_property_get',
    'computed' => TRUE,
  );
}