@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 66 lines 1.4 kB view raw
1<?php 2 3final class PhabricatorBoolEditField 4 extends PhabricatorEditField { 5 6 private $options; 7 private $asCheckbox; 8 9 public function setOptions($off_label, $on_label) { 10 $this->options = array( 11 '0' => $off_label, 12 '1' => $on_label, 13 ); 14 return $this; 15 } 16 17 public function getOptions() { 18 return $this->options; 19 } 20 21 public function setAsCheckbox($as_checkbox) { 22 $this->asCheckbox = $as_checkbox; 23 return $this; 24 } 25 26 public function getAsCheckbox() { 27 return $this->asCheckbox; 28 } 29 30 protected function newControl() { 31 $options = $this->getOptions(); 32 33 if (!$options) { 34 $options = array( 35 '0' => pht('False'), 36 '1' => pht('True'), 37 ); 38 } 39 40 if ($this->getAsCheckbox()) { 41 $key = $this->getKey(); 42 $value = $this->getValueForControl(); 43 $checkbox_key = $this->newHTTPParameterType() 44 ->getCheckboxKey($key); 45 $id = $this->getControlID(); 46 47 $control = id(new AphrontFormCheckboxControl()) 48 ->setCheckboxKey($checkbox_key) 49 ->addCheckbox($key, '1', $options['1'], $value, $id); 50 } else { 51 $control = id(new AphrontFormSelectControl()) 52 ->setOptions($options); 53 } 54 55 return $control; 56 } 57 58 protected function newHTTPParameterType() { 59 return new AphrontBoolHTTPParameterType(); 60 } 61 62 protected function newConduitParameterType() { 63 return new ConduitBoolParameterType(); 64 } 65 66}