@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
at recaptime-dev/main 68 lines 1.8 kB view raw
1<?php 2 3final class AphrontFormTextWithSubmitControl extends AphrontFormControl { 4 5 private $submitLabel; 6 private $readOnly; 7 8 public function setSubmitLabel($submit_label) { 9 $this->submitLabel = $submit_label; 10 return $this; 11 } 12 13 public function getSubmitLabel() { 14 return $this->submitLabel; 15 } 16 17 public function setReadOnly($read_only) { 18 $this->readOnly = $read_only; 19 return $this; 20 } 21 22 protected function getReadOnly() { 23 return $this->readOnly; 24 } 25 26 protected function getCustomControlClass() { 27 return 'aphront-form-control-text-with-submit'; 28 } 29 30 protected function renderInput() { 31 return phutil_tag( 32 'div', 33 array( 34 'class' => 'text-with-submit-control-outer-bounds', 35 ), 36 array( 37 phutil_tag( 38 'div', 39 array( 40 'class' => 'text-with-submit-control-text-bounds', 41 ), 42 javelin_tag( 43 'input', 44 array( 45 'type' => 'text', 46 'class' => 'text-with-submit-control-text', 47 'name' => $this->getName(), 48 'value' => $this->getValue(), 49 'disabled' => $this->getDisabled() ? 'disabled' : null, 50 'readonly' => $this->getReadOnly() ? 'readonly' : null, 51 'id' => $this->getID(), 52 ))), 53 phutil_tag( 54 'div', 55 array( 56 'class' => 'text-with-submit-control-submit-bounds', 57 ), 58 javelin_tag( 59 'input', 60 array( 61 'type' => 'submit', 62 'class' => 'text-with-submit-control-submit grey', 63 'value' => coalesce($this->getSubmitLabel(), pht('Submit')), 64 ))), 65 )); 66 } 67 68}