forked from omeka/plugin-ItemRelations
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathItemRelationsProperty.php
68 lines (59 loc) · 1.47 KB
/
ItemRelationsProperty.php
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
<?php
/**
* Item Relations
* @copyright Copyright 2010-2014 Roy Rosenzweig Center for History and New Media
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* Item Relations Property model.
*/
class ItemRelationsProperty extends Omeka_Record_AbstractRecord
{
/**
* @var int
*/
public $id;
/**
* @var int
*/
public $vocabulary_id;
/**
* Internal name for the property within its vocabulary.
* @var string
*/
public $local_part;
/**
* Human-readable name for the property.
* @var string
*/
public $label;
/**
* Human-readable description for the property.
* @var string
*/
public $description;
/**
* Get a text representation of the property.
*
* The format of the representation is controlled by the
* 'item_relations_relation_format' option.
*
* @return string
*/
public function getText()
{
$hasPrefixLocalPart =
(bool) $this->vocabulary_namespace_prefix && (bool) $this->local_part;
$hasLabel = (bool) $this->label;
if (get_option('item_relations_relation_format') == 'prefix_local_part'
&& $hasPrefixLocalPart
) {
$text = $this->vocabulary_namespace_prefix . ':' . $this->local_part;
} else if ($hasLabel) {
$text = $this->label;
} else {
$text = __('[unknown]');
}
return $text;
}
}