[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/releeph/view/branch/ -> ReleephBranchPreviewView.php (source)

   1  <?php
   2  
   3  final class ReleephBranchPreviewView extends AphrontFormControl {
   4  
   5    private $statics = array();
   6    private $dynamics = array();
   7  
   8    public function addControl($param_name, AphrontFormControl $control) {
   9      $celerity_id = celerity_generate_unique_node_id();
  10      $control->setID($celerity_id);
  11      $this->dynamics[$param_name] = $celerity_id;
  12      return $this;
  13    }
  14  
  15    public function addStatic($param_name, $value) {
  16      $this->statics[$param_name] = $value;
  17      return $this;
  18    }
  19  
  20    public function getCustomControlClass() {
  21      require_celerity_resource('releeph-preview-branch');
  22      return 'releeph-preview-branch';
  23    }
  24  
  25    public function renderInput() {
  26      static $required_params = array(
  27        'arcProjectID',
  28        'projectName',
  29        'isSymbolic',
  30        'template',
  31      );
  32  
  33      $all_params = array_merge($this->statics, $this->dynamics);
  34      foreach ($required_params as $param_name) {
  35        if (idx($all_params, $param_name) === null) {
  36          throw new Exception(
  37            "'{$param_name}' is not set as either a static or dynamic!");
  38        }
  39      }
  40  
  41      $output_id = celerity_generate_unique_node_id();
  42  
  43      Javelin::initBehavior('releeph-preview-branch', array(
  44        'uri'           => '/releeph/branch/preview/',
  45        'outputID'      => $output_id,
  46        'params'        => array(
  47          'static'  => $this->statics,
  48          'dynamic' => $this->dynamics,
  49        ),
  50      ));
  51  
  52      return phutil_tag(
  53        'div',
  54        array(
  55          'id' => $output_id,
  56        ),
  57        '');
  58    }
  59  
  60  }


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