-
Notifications
You must be signed in to change notification settings - Fork 0
/
membership_entity.info.inc
74 lines (62 loc) · 2.18 KB
/
membership_entity.info.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* @file
* Provides entity metadata integration.
*/
/**
* Provides metadata for memberships.
*/
class MembershipEntityMetadataController extends EntityDefaultMetadataController {
/**
* Overrides EntityDefaultMetadataController::entityPropertyInfo().
*/
public function entityPropertyInfo() {
$info = parent::entityPropertyInfo();
$properties = &$info[$this->type]['properties'];
$properties['mid'] = array(
'label' => t('Internal id'),
'description' => t('The unique membership identifier used internally and in URLs.'),
'required' => TRUE,
) + $properties['mid'];
$properties['member_id'] = array(
'label' => t('Member id'),
'description' => t('The Member ID assigned to the membership.'),
'required' => TRUE,
) + $properties['member_id'];
$properties['type'] = array(
'label' => t('Type'),
'description' => t('The membership type.'),
'required' => TRUE,
) + $properties['type'];
unset($properties['uid']);
$properties['primary_member'] = array(
'label' => t('Primary member'),
'type' => 'user',
'description' => t('The primary member on the membership.'),
'getter callback' => 'entity_property_getter_method',
'setter callback' => 'entity_property_setter_method',
'setter permission' => 'administer memberships',
'required' => TRUE,
'schema field' => 'uid',
);
$properties['status'] = array(
'label' => t('Membership status'),
'description' => t('The membership status.'),
'options list' => 'membership_entity_get_status_list',
) + $properties['status'];
$properties['created'] = array(
'type' => 'date',
'label' => t('Date created'),
'description' => t('The date the membership was created.'),
'setter callback' => 'entity_property_verbatim_set',
'setter permission' => 'administer memberships',
) + $properties['created'];
$properties['changed'] = array(
'type' => 'date',
'label' => t('Date changed'),
'description' => t('The date the membership was most recently updated.'),
) + $properties['changed'];
unset($properties['url']);
return $info;
}
}