@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.

Support specifying form fields as readonly

Summary:
Similar to AphrontFormTextAreaControl.

I went with manually specifying the property in each class, as there
are only 5 (AphrontFormTextControl is handled in D26195) and other
types of inputs do not support the readonly property.

Ref T16177

Test Plan: Compare against AphrontFormTextAreaControl. If feeling adventurous, maybe change one of the callers of the input fields to readonly.

Reviewers: O1 Blessed Committers, valerio.bozzolan, aklapper

Reviewed By: O1 Blessed Committers, valerio.bozzolan, aklapper

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16177

Differential Revision: https://we.phorge.it/D26200

+45
+11
src/view/form/control/AphrontFormTextWithSubmitControl.php
··· 3 3 final class AphrontFormTextWithSubmitControl extends AphrontFormControl { 4 4 5 5 private $submitLabel; 6 + private $readOnly; 6 7 7 8 public function setSubmitLabel($submit_label) { 8 9 $this->submitLabel = $submit_label; ··· 11 12 12 13 public function getSubmitLabel() { 13 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; 14 24 } 15 25 16 26 protected function getCustomControlClass() { ··· 37 47 'name' => $this->getName(), 38 48 'value' => $this->getValue(), 39 49 'disabled' => $this->getDisabled() ? 'disabled' : null, 50 + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 40 51 'id' => $this->getID(), 41 52 ))), 42 53 phutil_tag(
+11
src/view/form/control/AphrontFormTypeaheadControl.php
··· 4 4 5 5 private $hardpointID; 6 6 private $placeholder; 7 + private $readonly; 7 8 8 9 public function setHardpointID($hardpoint_id) { 9 10 $this->hardpointID = $hardpoint_id; ··· 19 20 return $this; 20 21 } 21 22 23 + public function setReadOnly($read_only) { 24 + $this->readOnly = $read_only; 25 + return $this; 26 + } 27 + 28 + protected function getReadOnly() { 29 + return $this->readOnly; 30 + } 31 + 22 32 protected function getCustomControlClass() { 23 33 return 'aphront-form-control-typeahead'; 24 34 } ··· 38 48 'value' => $this->getValue(), 39 49 'placeholder' => $this->placeholder, 40 50 'disabled' => $this->getDisabled() ? 'disabled' : null, 51 + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 41 52 'autocomplete' => 'off', 42 53 'id' => $this->getID(), 43 54 )));
+12
src/view/form/control/PHUIFormFreeformDateControl.php
··· 2 2 3 3 final class PHUIFormFreeformDateControl extends AphrontFormControl { 4 4 5 + private $readOnly; 6 + 7 + public function setReadOnly($read_only) { 8 + $this->readOnly = $read_only; 9 + return $this; 10 + } 11 + 12 + protected function getReadOnly() { 13 + return $this->readOnly; 14 + } 15 + 5 16 protected function getCustomControlClass() { 6 17 return 'aphront-form-control-text'; 7 18 } ··· 14 25 'name' => $this->getName(), 15 26 'value' => $this->getValue(), 16 27 'disabled' => $this->getDisabled() ? 'disabled' : null, 28 + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 17 29 'id' => $this->getID(), 18 30 )); 19 31 }
+11
src/view/form/control/PHUIFormNumberControl.php
··· 4 4 5 5 private $disableAutocomplete; 6 6 private $autofocus; 7 + private $readOnly; 7 8 8 9 public function setDisableAutocomplete($disable_autocomplete) { 9 10 $this->disableAutocomplete = $disable_autocomplete; ··· 23 24 return $this->autofocus; 24 25 } 25 26 27 + public function setReadOnly($read_only) { 28 + $this->readOnly = $read_only; 29 + return $this; 30 + } 31 + 32 + protected function getReadOnly() { 33 + return $this->readOnly; 34 + } 35 + 26 36 protected function getCustomControlClass() { 27 37 return 'phui-form-number'; 28 38 } ··· 42 52 'name' => $this->getName(), 43 53 'value' => $this->getValue(), 44 54 'disabled' => $this->getDisabled() ? 'disabled' : null, 55 + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 45 56 'autocomplete' => $autocomplete, 46 57 'id' => $this->getID(), 47 58 'autofocus' => ($this->getAutofocus() ? 'autofocus' : null),