[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

   1  <?php
   2  
   3  final class PhabricatorUserRealNameField
   4    extends PhabricatorUserCustomField {
   5  
   6    private $value;
   7  
   8    public function getFieldKey() {
   9      return 'user:realname';
  10    }
  11  
  12    public function getFieldName() {
  13      return pht('Real Name');
  14    }
  15  
  16    public function getFieldDescription() {
  17      return pht('Stores the real name of the user, like "Abraham Lincoln".');
  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->getRealName();
  34    }
  35  
  36    public function getOldValueForApplicationTransactions() {
  37      return $this->getObject()->getRealName();
  38    }
  39  
  40    public function getNewValueForApplicationTransactions() {
  41      if (!$this->isEditable()) {
  42        return $this->getObject()->getRealName();
  43      }
  44      return $this->value;
  45    }
  46  
  47    public function applyApplicationTransactionInternalEffects(
  48      PhabricatorApplicationTransaction $xaction) {
  49      $this->getObject()->setRealName($xaction->getNewValue());
  50    }
  51  
  52    public function readValueFromRequest(AphrontRequest $request) {
  53      $this->value = $request->getStr($this->getFieldKey());
  54    }
  55  
  56    public function renderEditControl(array $handles) {
  57      return id(new AphrontFormTextControl())
  58        ->setName($this->getFieldKey())
  59        ->setValue($this->value)
  60        ->setLabel($this->getFieldName())
  61        ->setDisabled(!$this->isEditable());
  62    }
  63  
  64    private function isEditable() {
  65      return PhabricatorEnv::getEnvConfig('account.editable');
  66    }
  67  
  68  }


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