[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/people/customfield/ -> PhabricatorUserTitleField.php (source)

   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 getFieldName() {
  13      return pht('Title');
  14    }
  15  
  16    public function getFieldDescription() {
  17      return pht('User title, like "CEO" or "Assistant to the Manager".');
  18    }
  19  
  20    public function canDisableField() {
  21      return false;
  22    }
  23  
  24    public function shouldAppearInApplicationTransactions() {
  25      return true;
  26    }
  27  
  28    public function shouldAppearInEditView() {
  29      return true;
  30    }
  31  
  32    public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
  33      $this->value = $object->loadUserProfile()->getTitle();
  34    }
  35  
  36    public function getOldValueForApplicationTransactions() {
  37      return $this->getObject()->loadUserProfile()->getTitle();
  38    }
  39  
  40    public function getNewValueForApplicationTransactions() {
  41      return $this->value;
  42    }
  43  
  44    public function applyApplicationTransactionInternalEffects(
  45      PhabricatorApplicationTransaction $xaction) {
  46      $this->getObject()->loadUserProfile()->setTitle($xaction->getNewValue());
  47    }
  48  
  49    public function readValueFromRequest(AphrontRequest $request) {
  50      $this->value = $request->getStr($this->getFieldKey());
  51    }
  52  
  53    public function renderEditControl(array $handles) {
  54      return id(new AphrontFormTextControl())
  55        ->setName($this->getFieldKey())
  56        ->setValue($this->value)
  57        ->setLabel($this->getFieldName())
  58        ->setCaption(pht('Serious business title.'));
  59    }
  60  
  61  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1