mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-22 12:41:19 +01:00
06aa207960
Summary: Ref T10054. This primarily improves aesthetics and consistency for member/wathcher lists in projects. Test Plan: {F1068873} {F1068874} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10054 Differential Revision: https://secure.phabricator.com/D15103
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class PhabricatorUserTitleField
|
|
extends PhabricatorUserCustomField {
|
|
|
|
private $value;
|
|
|
|
public function getFieldKey() {
|
|
return 'user:title';
|
|
}
|
|
|
|
public function getFieldName() {
|
|
return pht('Title');
|
|
}
|
|
|
|
public function getFieldDescription() {
|
|
return pht('User title, like "CEO" or "Assistant to the Manager".');
|
|
}
|
|
|
|
public function canDisableField() {
|
|
return false;
|
|
}
|
|
|
|
public function shouldAppearInApplicationTransactions() {
|
|
return true;
|
|
}
|
|
|
|
public function shouldAppearInEditView() {
|
|
return true;
|
|
}
|
|
|
|
public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
|
|
$this->value = $object->loadUserProfile()->getTitle();
|
|
}
|
|
|
|
public function getOldValueForApplicationTransactions() {
|
|
return $this->getObject()->loadUserProfile()->getTitle();
|
|
}
|
|
|
|
public function getNewValueForApplicationTransactions() {
|
|
return $this->value;
|
|
}
|
|
|
|
public function applyApplicationTransactionInternalEffects(
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
$this->getObject()->loadUserProfile()->setTitle($xaction->getNewValue());
|
|
}
|
|
|
|
public function readValueFromRequest(AphrontRequest $request) {
|
|
$this->value = $request->getStr($this->getFieldKey());
|
|
}
|
|
|
|
public function renderEditControl(array $handles) {
|
|
return id(new AphrontFormTextControl())
|
|
->setName($this->getFieldKey())
|
|
->setValue($this->value)
|
|
->setLabel($this->getFieldName());
|
|
}
|
|
|
|
}
|