Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/people/customfield/PhabricatorUserTitleField.php
12256 views
1
<?php
2
3
final class PhabricatorUserTitleField
4
extends PhabricatorUserCustomField {
5
6
private $value;
7
8
public function getFieldKey() {
9
return 'user:title';
10
}
11
12
public function getModernFieldKey() {
13
return 'title';
14
}
15
16
public function getFieldKeyForConduit() {
17
return $this->getModernFieldKey();
18
}
19
20
public function getFieldName() {
21
return pht('Title');
22
}
23
24
public function getFieldDescription() {
25
return pht('User title, like "CEO" or "Assistant to the Manager".');
26
}
27
28
public function canDisableField() {
29
return false;
30
}
31
32
public function shouldAppearInApplicationTransactions() {
33
return true;
34
}
35
36
public function shouldAppearInEditView() {
37
return true;
38
}
39
40
public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
41
$this->value = $object->loadUserProfile()->getTitle();
42
}
43
44
public function getOldValueForApplicationTransactions() {
45
return $this->getObject()->loadUserProfile()->getTitle();
46
}
47
48
public function getNewValueForApplicationTransactions() {
49
return $this->value;
50
}
51
52
public function applyApplicationTransactionInternalEffects(
53
PhabricatorApplicationTransaction $xaction) {
54
$this->getObject()->loadUserProfile()->setTitle($xaction->getNewValue());
55
}
56
57
public function readValueFromRequest(AphrontRequest $request) {
58
$this->value = $request->getStr($this->getFieldKey());
59
}
60
61
public function setValueFromStorage($value) {
62
$this->value = $value;
63
return $this;
64
}
65
66
public function renderEditControl(array $handles) {
67
return id(new AphrontFormTextControl())
68
->setName($this->getFieldKey())
69
->setValue($this->value)
70
->setLabel($this->getFieldName());
71
}
72
73
public function shouldAppearInConduitTransactions() {
74
return true;
75
}
76
77
protected function newConduitEditParameterType() {
78
return new ConduitStringParameterType();
79
}
80
81
}
82
83