public function UserpointsTransactionMetadataController::entityPropertyInfo in User Points 7.2
Overrides EntityDefaultMetadataController::entityPropertyInfo().
Overrides EntityDefaultMetadataController::entityPropertyInfo
File
- ./
userpoints.transaction.inc, line 1301 - Contains the UserpointsTransaction and related classes.
Class
- UserpointsTransactionMetadataController
- Extends property metadata for the Userpoints Transaction entity.
Code
public function entityPropertyInfo() {
$info = parent::entityPropertyInfo();
$properties =& $info['userpoints_transaction']['properties'];
$properties['user'] = array(
'type' => 'user',
'label' => t('User'),
'description' => t('The user that will receive the !points', userpoints_translation()),
'setter callback' => 'userpoints_transaction_property_set',
'getter callback' => 'userpoints_transaction_property_get',
'schema field' => 'uid',
);
$properties['points']['label'] = t('!Points', userpoints_translation());
$properties['points']['description'] = t('Amount of !points to give or take.', userpoints_translation());
$properties['type'] = array(
'label' => t('!Points transaction type', userpoints_translation()),
'description' => t('The bundle entity for !points transactions.', userpoints_translation()),
'type' => 'userpoints_transaction_type',
);
$properties['points_abs'] = array(
'label' => t('!Points absolute', userpoints_translation()),
'description' => t('The absolute (positive) amount of !points of this transaction.', userpoints_translation()),
'type' => 'integer',
'getter callback' => 'userpoints_transaction_get_points_absolute',
);
$properties['tid'] = array(
'label' => t('!Points category', userpoints_translation()),
'description' => t('The category to which these transaction belongs.'),
'options list' => 'userpoints_rules_get_categories',
) + $properties['tid'];
$properties['entity'] = array(
'label' => t('Entity'),
'type' => 'entity',
'description' => t('The entity to which this transaction refers.'),
'optional' => TRUE,
'getter callback' => 'userpoints_transaction_property_get',
);
$properties['description'] = array(
'label' => t('Description'),
'description' => t('Can contain the reason why the points have been given.'),
'optional' => TRUE,
) + $properties['description'];
$properties['reference'] = array(
'label' => t('Reference'),
'description' => t('Can contain a reference for this transaction.'),
'optional' => TRUE,
) + $properties['reference'];
$properties['operation'] = array(
'label' => t('Operation'),
'description' => t('Describes the operation (Insert/Remove/...).'),
) + $properties['operation'];
$properties['reason'] = array(
'label' => t('Reason'),
'type' => 'text',
'description' => t('The reason why the points were granted.'),
'getter callback' => 'userpoints_transaction_property_get',
);
$properties['parent_txn_id'] = array(
'label' => t('Parent transaction'),
'description' => t('ID of the parent transaction.'),
) + $properties['parent_txn_id'];
$properties['entity_id'] = array(
'label' => t('Entity ID'),
'description' => t('Id of the referenced entity.'),
) + $properties['entity_id'];
$properties['entity_type'] = array(
'label' => t('Entity type'),
'description' => t('Type of the referenced entity.'),
) + $properties['entity_type'];
$properties['uid'] = array(
'label' => t('User ID'),
'description' => t('ID of the user who received the point.'),
) + $properties['uid'];
$properties['approver_uid'] = array(
'label' => t('Approver UID'),
'description' => t('User ID of the user who approved the transaction.'),
) + $properties['approver_uid'];
$properties['time_stamp'] = array(
'label' => t('Timestamp'),
'type' => 'date',
'description' => t('Time when the points were given.'),
) + $properties['time_stamp'];
$properties['changed'] = array(
'label' => t('Changed'),
'type' => 'date',
'description' => t('Time when the transaction was last changed.'),
) + $properties['time_stamp'];
$properties['expired'] = array(
'label' => t('Expired'),
'type' => 'boolean',
'description' => t('If the transaction is expired.'),
) + $properties['expired'];
$properties['expirydate'] = array(
'label' => t('Expiry date'),
'type' => 'date',
'description' => t('Time when the points will expire.'),
) + $properties['expirydate'];
$properties['display'] = array(
'label' => t('Display'),
'type' => 'boolean',
'description' => t('Whether to show a message to the user for this transaction or not.'),
'setter callback' => 'userpoints_transaction_property_set',
'getter callback' => 'userpoints_transaction_property_get',
);
$properties['status'] = array(
'label' => t('Status'),
'description' => t('Status of this transaction.'),
'options list' => 'userpoints_txn_status',
) + $properties['status'];
// Add default setter callback.
foreach ($properties as $key => &$property) {
if (isset($property['setter callback'])) {
continue;
}
// Exclude some read only properties.
if (in_array($key, array(
'display',
'reason',
'entity',
'points_abs',
))) {
continue;
}
$property['setter callback'] = 'entity_property_verbatim_set';
}
return $info;
}