function commerce_pricelist_entity_property_info in Commerce Pricelist 7
Implements hook_entity_property_info().
Return value
array
File
- ./
commerce_pricelist.module, line 170 - Implements the basic functionality required for price lists
Code
function commerce_pricelist_entity_property_info() {
$info = array();
// Add meta-data about the commerce_pricelist_list properties.
$properties = array();
$properties['list_id'] = array(
'label' => t('List ID'),
'description' => t('The internal numeric ID of the pricelist.'),
'type' => 'integer',
'schema field' => 'list_id',
);
$properties['title'] = array(
'label' => t('Title'),
'description' => t('The title of the list.'),
'type' => 'text',
'setter callback' => 'entity_property_verbatim_set',
'required' => TRUE,
'schema field' => 'title',
);
$properties['uid'] = array(
'label' => t("Author"),
'type' => 'user',
'description' => t("The author of the pricelist."),
'setter callback' => 'entity_property_verbatim_set',
'required' => TRUE,
'schema field' => 'uid',
);
$properties['weight'] = array(
'label' => t('Weight'),
'type' => 'integer',
'setter callback' => 'entity_property_verbatim_set',
'description' => t("The weight of the list."),
'required' => TRUE,
'schema field' => 'weight',
);
$properties['status'] = array(
'label' => t('Status'),
'description' => t('Whether or not the pricelist is active.'),
'type' => 'boolean',
'setter callback' => 'entity_property_verbatim_set',
'schema field' => 'status',
);
$properties['created'] = array(
'label' => t('Date created'),
'description' => t('The date the pricelist was created.'),
'type' => 'date',
'setter callback' => 'entity_property_verbatim_set',
'schema field' => 'created',
);
$properties['changed'] = array(
'label' => t('Date updated'),
'description' => t('The date the pricelist was last updated.'),
'type' => 'date',
'schema field' => 'changed',
);
// @todo: Info about 'data' property.
$info['commerce_pricelist_list']['properties'] = $properties;
// Add meta-data about the commerce_pricelist_item properties.
$properties = array();
$properties['item_id'] = array(
'label' => t('List ID'),
'description' => t('The internal numeric ID of the pricelist the item belongs to.'),
'type' => 'integer',
'schema field' => 'item_id',
);
$properties['sku'] = array(
'label' => t('SKU'),
'description' => t('The human readable product SKU.'),
'type' => 'text',
'setter callback' => 'entity_property_verbatim_set',
'required' => TRUE,
'schema field' => 'sku',
);
$properties['pricelist_id'] = array(
'label' => t('List ID'),
'description' => t('The internal numeric ID of the pricelist the item belongs to.'),
'type' => 'commerce_pricelist_list',
'setter callback' => 'entity_property_verbatim_set',
'schema field' => 'pricelist_id',
);
$properties['valid_from'] = array(
'label' => t('Valid from date'),
'description' => t('The date item will be active from.'),
'type' => 'date',
'setter callback' => 'entity_property_verbatim_set',
'schema field' => 'valid_from',
);
$properties['valid_to'] = array(
'label' => t('Valid to date'),
'description' => t('The date item will be active to.'),
'type' => 'date',
'setter callback' => 'entity_property_verbatim_set',
'schema field' => 'valid_to',
);
$properties['quantity'] = array(
'label' => t('Quantity'),
'description' => t('Quantity associated with this pricelist item'),
'type' => 'decimal',
'setter callback' => 'entity_property_verbatim_set',
'required' => TRUE,
'schema field' => 'quantity',
);
$properties['price_amount'] = array(
'label' => t('Amount'),
'description' => t('The amount for this pricelist item.'),
'type' => 'integer',
'setter callback' => 'entity_property_verbatim_set',
'schema field' => 'price_amount',
);
$properties['currency_code'] = array(
'label' => t('Currency Code'),
'description' => t('The currency code for this pricelist item.'),
'type' => 'text',
'setter callback' => 'entity_property_verbatim_set',
'schema field' => 'currency_code',
);
$info['commerce_pricelist_item']['properties'] = $properties;
return $info;
}