Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/people/customfield/PhabricatorUserIconField.php
12256 views
1
<?php
2
3
final class PhabricatorUserIconField
4
extends PhabricatorUserCustomField {
5
6
private $value;
7
8
public function getFieldKey() {
9
return 'user:icon';
10
}
11
12
public function getModernFieldKey() {
13
return 'icon';
14
}
15
16
public function getFieldKeyForConduit() {
17
return $this->getModernFieldKey();
18
}
19
20
public function getFieldName() {
21
return pht('Icon');
22
}
23
24
public function getFieldDescription() {
25
return pht('User icon to accompany their title.');
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()->getIcon();
42
}
43
44
public function getOldValueForApplicationTransactions() {
45
return $this->getObject()->loadUserProfile()->getIcon();
46
}
47
48
public function getNewValueForApplicationTransactions() {
49
return $this->value;
50
}
51
52
public function applyApplicationTransactionInternalEffects(
53
PhabricatorApplicationTransaction $xaction) {
54
$this->getObject()->loadUserProfile()->setIcon($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 PHUIFormIconSetControl())
68
->setName($this->getFieldKey())
69
->setValue($this->value)
70
->setLabel($this->getFieldName())
71
->setIconSet(new PhabricatorPeopleIconSet());
72
}
73
74
public function shouldAppearInConduitTransactions() {
75
return true;
76
}
77
78
protected function newConduitEditParameterType() {
79
return new ConduitStringParameterType();
80
}
81
82
}
83
84