-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprivatemsg.entity.inc
99 lines (87 loc) · 1.69 KB
/
privatemsg.entity.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* @file
* Class for private messages.
*/
/**
* Defines the private messages class.
*/
class PrivatemsgMessage extends Entity {
/**
* The message ID.
*
* @var integer
*/
public $mid;
/**
* The message type (bundle).
*
* @var string
*/
public $type;
/**
* A message ID that is the parent of this message.
*
* @var integer
*/
public $thread_id;
/**
* The uid of the user who is associated with the private message.
*
* @var integer
*/
public $author;
/**
* The message subject.
*
* @var string
*/
public $subject;
/**
* Constructor for private message entities.
*/
public function __construct(array $values = array()) {
parent::__construct($values);
}
/**
* Implements EntityInterface::id().
*/
public function id() {
return isset($this->mid) ? $this->mid : NULL;
}
/**
* Implements EntityInterface::entityType().
*/
public function entityType() {
return 'privatemsg_message';
}
/**
* Implements EntityInterface::bundle().
*/
public function bundle() {
return $this->entityType();
}
/**
* Implements EntityInterface::label().
*/
public function label() {
return $this->subject;
}
/**
* Implements EntityInterface::uri().
*/
public function uri() {
$uri = array();
if (isset($this->mid) && isset($this->thread_id)) {
$uri = array(
'path' => 'messages/view/' . $this->thread_id,
'options' => array(),
);
// Add message fragment, if necessary.
if ($this->mid != $this->thread_id) {
$uri['options']['fragment'] = 'privatemsg-mid-' . $this->mid;
}
}
return $uri;
}
}