You are here

public function UcOrderProductMetadataController::entityPropertyInfo in Ubercart 7.3

Overrides EntityDefaultMetadataController::entityPropertyInfo

File

uc_order/uc_order.info.inc, line 123
Entity Metadata hooks.

Class

UcOrderProductMetadataController
Metadata controller class for uc_order_product entities.

Code

public function entityPropertyInfo() {
  $props = parent::entityPropertyInfo();

  // Copy the descriptions from the schema. Drupal discards this information, so we have to
  // call uc_order_schema() directly.
  module_load_include('install', 'uc_order', 'uc_order');
  $schema = uc_order_schema();
  foreach ($schema['uc_order_products']['fields'] as $name => $info) {
    if (is_array($props['uc_order_product']['properties'][$name]) && !empty($info['description'])) {
      $props['uc_order_product']['properties'][$name]['description'] = $info['description'];
    }
  }

  // Add the 'node' property.
  $props['uc_order_product']['properties']['node'] = array(
    'type' => 'node',
    'label' => t('Node'),
    'description' => t('The node representing the product.'),
    'getter callback' => 'uc_order_product_node_property_get',
    'setter callback' => 'uc_order_product_node_property_set',
  );
  return $props;
}