Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/almanac/editor/AlmanacPropertyEditEngine.php
12256 views
1
<?php
2
3
abstract class AlmanacPropertyEditEngine
4
extends PhabricatorEditEngine {
5
6
private $propertyKey;
7
8
public function setPropertyKey($property_key) {
9
$this->propertyKey = $property_key;
10
return $this;
11
}
12
13
public function getPropertyKey() {
14
return $this->propertyKey;
15
}
16
17
public function isEngineConfigurable() {
18
return false;
19
}
20
21
public function isEngineExtensible() {
22
return false;
23
}
24
25
public function getEngineName() {
26
return pht('Almanac Properties');
27
}
28
29
public function getSummaryHeader() {
30
return pht('Edit Almanac Property Configurations');
31
}
32
33
public function getSummaryText() {
34
return pht('This engine is used to edit Almanac properties.');
35
}
36
37
public function getEngineApplicationClass() {
38
return 'PhabricatorAlmanacApplication';
39
}
40
41
protected function newEditableObject() {
42
throw new PhutilMethodNotImplementedException();
43
}
44
45
protected function getObjectCreateTitleText($object) {
46
return pht('Create Property');
47
}
48
49
protected function getObjectCreateButtonText($object) {
50
return pht('Create Property');
51
}
52
53
protected function getObjectEditTitleText($object) {
54
return pht('Edit Property: %s', $object->getName());
55
}
56
57
protected function getObjectEditShortText($object) {
58
return pht('Edit Property');
59
}
60
61
protected function getObjectCreateShortText() {
62
return pht('Create Property');
63
}
64
65
protected function buildCustomEditFields($object) {
66
$property_key = $this->getPropertyKey();
67
$xaction_type = $object->getAlmanacPropertySetTransactionType();
68
69
$specs = $object->getAlmanacPropertyFieldSpecifications();
70
if (isset($specs[$property_key])) {
71
$field_template = clone $specs[$property_key];
72
} else {
73
$field_template = new PhabricatorTextEditField();
74
}
75
76
return array(
77
$field_template
78
->setKey('value')
79
->setMetadataValue('almanac.property', $property_key)
80
->setLabel($property_key)
81
->setTransactionType($xaction_type)
82
->setValue($object->getAlmanacPropertyValue($property_key)),
83
);
84
}
85
86
}
87
88