Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / releeph / view / branch / ReleephBranchPreviewView.php
blob462ed73db3067e04aaae1becce138cf95c328c77
1 <?php
3 final class ReleephBranchPreviewView extends AphrontFormControl {
5 private $statics = array();
6 private $dynamics = array();
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;
15 public function addStatic($param_name, $value) {
16 $this->statics[$param_name] = $value;
17 return $this;
20 protected function getCustomControlClass() {
21 require_celerity_resource('releeph-preview-branch');
22 return 'releeph-preview-branch';
25 protected function renderInput() {
26 static $required_params = array(
27 'repositoryPHID',
28 'projectName',
29 'isSymbolic',
30 'template',
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 pht(
38 "'%s' is not set as either a static or dynamic!",
39 $param_name));
43 $output_id = celerity_generate_unique_node_id();
45 Javelin::initBehavior('releeph-preview-branch', array(
46 'uri' => '/releeph/branch/preview/',
47 'outputID' => $output_id,
48 'params' => array(
49 'static' => $this->statics,
50 'dynamic' => $this->dynamics,
52 ));
54 return phutil_tag(
55 'div',
56 array(
57 'id' => $output_id,
59 '');