[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/customfield/standard/ -> PhabricatorStandardCustomFieldRemarkup.php (source)

   1  <?php
   2  
   3  final class PhabricatorStandardCustomFieldRemarkup
   4    extends PhabricatorStandardCustomField {
   5  
   6    public function getFieldType() {
   7      return 'remarkup';
   8    }
   9  
  10    public function renderEditControl(array $handles) {
  11      return id(new PhabricatorRemarkupControl())
  12        ->setUser($this->getViewer())
  13        ->setLabel($this->getFieldName())
  14        ->setName($this->getFieldKey())
  15        ->setCaption($this->getCaption())
  16        ->setValue($this->getFieldValue());
  17    }
  18  
  19    public function getStyleForPropertyView() {
  20      return 'block';
  21    }
  22  
  23    public function getApplicationTransactionRemarkupBlocks(
  24      PhabricatorApplicationTransaction $xaction) {
  25      return array(
  26        $xaction->getNewValue(),
  27      );
  28    }
  29  
  30    public function renderPropertyViewValue(array $handles) {
  31      $value = $this->getFieldValue();
  32  
  33      if (!strlen($value)) {
  34        return null;
  35      }
  36  
  37      // TODO: Once this stabilizes, it would be nice to let fields batch this.
  38      // For now, an extra query here and there on object detail pages isn't the
  39      // end of the world.
  40  
  41      $viewer = $this->getViewer();
  42      return PhabricatorMarkupEngine::renderOneObject(
  43        id(new PhabricatorMarkupOneOff())
  44          ->setContent($value)
  45          ->setPReserveLinebreaks(true),
  46        'default',
  47        $viewer);
  48    }
  49  
  50    public function getApplicationTransactionTitle(
  51      PhabricatorApplicationTransaction $xaction) {
  52      $author_phid = $xaction->getAuthorPHID();
  53  
  54      // TODO: Expose fancy transactions.
  55  
  56      return pht(
  57        '%s edited %s.',
  58        $xaction->renderHandleLink($author_phid),
  59        $this->getFieldName());
  60    }
  61  
  62    public function shouldAppearInHerald() {
  63      return true;
  64    }
  65  
  66    public function getHeraldFieldConditions() {
  67      return array(
  68        HeraldAdapter::CONDITION_CONTAINS,
  69        HeraldAdapter::CONDITION_NOT_CONTAINS,
  70        HeraldAdapter::CONDITION_IS,
  71        HeraldAdapter::CONDITION_IS_NOT,
  72        HeraldAdapter::CONDITION_REGEXP,
  73      );
  74    }
  75  
  76  
  77  }


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