[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @concrete-extensible 5 */ 6 class AphrontFormTextAreaControl extends AphrontFormControl { 7 8 const HEIGHT_VERY_SHORT = 'very-short'; 9 const HEIGHT_SHORT = 'short'; 10 const HEIGHT_VERY_TALL = 'very-tall'; 11 12 private $height; 13 private $readOnly; 14 private $customClass; 15 private $placeHolder; 16 private $sigil; 17 18 public function setSigil($sigil) { 19 $this->sigil = $sigil; 20 return $this; 21 } 22 23 public function getSigil() { 24 return $this->sigil; 25 } 26 27 public function setPlaceHolder($place_holder) { 28 $this->placeHolder = $place_holder; 29 return $this; 30 } 31 private function getPlaceHolder() { 32 return $this->placeHolder; 33 } 34 35 public function setHeight($height) { 36 $this->height = $height; 37 return $this; 38 } 39 40 public function setReadOnly($read_only) { 41 $this->readOnly = $read_only; 42 return $this; 43 } 44 45 protected function getReadOnly() { 46 return $this->readOnly; 47 } 48 49 protected function getCustomControlClass() { 50 return 'aphront-form-control-textarea'; 51 } 52 53 public function setCustomClass($custom_class) { 54 $this->customClass = $custom_class; 55 return $this; 56 } 57 58 protected function renderInput() { 59 60 $height_class = null; 61 switch ($this->height) { 62 case self::HEIGHT_VERY_SHORT: 63 case self::HEIGHT_SHORT: 64 case self::HEIGHT_VERY_TALL: 65 $height_class = 'aphront-textarea-'.$this->height; 66 break; 67 } 68 69 $classes = array(); 70 $classes[] = $height_class; 71 $classes[] = $this->customClass; 72 $classes = trim(implode(' ', $classes)); 73 74 return javelin_tag( 75 'textarea', 76 array( 77 'name' => $this->getName(), 78 'disabled' => $this->getDisabled() ? 'disabled' : null, 79 'readonly' => $this->getReadonly() ? 'readonly' : null, 80 'class' => $classes, 81 'style' => $this->getControlStyle(), 82 'id' => $this->getID(), 83 'sigil' => $this->sigil, 84 'placeholder' => $this->getPlaceHolder(), 85 ), 86 // NOTE: This needs to be string cast, because if we pass `null` the 87 // tag will be self-closed and some browsers aren't thrilled about that. 88 (string)$this->getValue()); 89 } 90 91 }
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 |