[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

   1  <?php
   2  
   3  final class PhabricatorUserBlurbField
   4    extends PhabricatorUserCustomField {
   5  
   6    private $value;
   7  
   8    public function getFieldKey() {
   9      return 'user:blurb';
  10    }
  11  
  12    public function getFieldName() {
  13      return pht('Blurb');
  14    }
  15  
  16    public function getFieldDescription() {
  17      return pht('Short blurb about the user.');
  18    }
  19  
  20    public function shouldAppearInApplicationTransactions() {
  21      return true;
  22    }
  23  
  24    public function shouldAppearInEditView() {
  25      return true;
  26    }
  27  
  28    public function shouldAppearInPropertyView() {
  29      return true;
  30    }
  31  
  32    public function readValueFromObject(PhabricatorCustomFieldInterface $object) {
  33      $this->value = $object->loadUserProfile()->getBlurb();
  34    }
  35  
  36    public function getOldValueForApplicationTransactions() {
  37      return $this->getObject()->loadUserProfile()->getBlurb();
  38    }
  39  
  40    public function getNewValueForApplicationTransactions() {
  41      return $this->value;
  42    }
  43  
  44    public function applyApplicationTransactionInternalEffects(
  45      PhabricatorApplicationTransaction $xaction) {
  46      $this->getObject()->loadUserProfile()->setBlurb($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 PhabricatorRemarkupControl())
  55        ->setUser($this->getViewer())
  56        ->setName($this->getFieldKey())
  57        ->setValue($this->value)
  58        ->setLabel($this->getFieldName());
  59    }
  60  
  61    public function renderPropertyViewLabel() {
  62      return null;
  63    }
  64  
  65    public function renderPropertyViewValue(array $handles) {
  66      $blurb = $this->getObject()->loadUserProfile()->getBlurb();
  67      if (!strlen($blurb)) {
  68        return null;
  69      }
  70      return PhabricatorMarkupEngine::renderOneObject(
  71        id(new PhabricatorMarkupOneOff())->setContent($blurb),
  72        'default',
  73        $this->getViewer());
  74    }
  75  
  76    public function getStyleForPropertyView() {
  77      return 'block';
  78    }
  79  
  80  }


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