[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class AphrontFormRadioButtonControl extends AphrontFormControl { 4 5 private $buttons = array(); 6 7 public function addButton( 8 $value, 9 $label, 10 $caption, 11 $class = null, 12 $disabled = false) { 13 $this->buttons[] = array( 14 'value' => $value, 15 'label' => $label, 16 'caption' => $caption, 17 'class' => $class, 18 'disabled' => $disabled, 19 ); 20 return $this; 21 } 22 23 protected function getCustomControlClass() { 24 return 'aphront-form-control-radio'; 25 } 26 27 protected function renderInput() { 28 $rows = array(); 29 foreach ($this->buttons as $button) { 30 $id = celerity_generate_unique_node_id(); 31 $radio = phutil_tag( 32 'input', 33 array( 34 'id' => $id, 35 'type' => 'radio', 36 'name' => $this->getName(), 37 'value' => $button['value'], 38 'checked' => ($button['value'] == $this->getValue()) 39 ? 'checked' 40 : null, 41 'disabled' => ($this->getDisabled() || $button['disabled']) 42 ? 'disabled' 43 : null, 44 )); 45 $label = phutil_tag( 46 'label', 47 array( 48 'for' => $id, 49 'class' => $button['class'], 50 ), 51 $button['label']); 52 53 if ($button['caption']) { 54 $label = array( 55 $label, 56 phutil_tag_div('aphront-form-radio-caption', $button['caption']), 57 ); 58 } 59 $rows[] = phutil_tag('tr', array(), array( 60 phutil_tag('td', array(), $radio), 61 phutil_tag('th', array(), $label), 62 )); 63 } 64 65 return phutil_tag( 66 'table', 67 array('class' => 'aphront-form-control-radio-layout'), 68 $rows); 69 } 70 71 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |