diff --git a/src/view/form/control/AphrontFormTextWithSubmitControl.php b/src/view/form/control/AphrontFormTextWithSubmitControl.php index 07b872d1fe..ed33f3ce82 100644 --- a/src/view/form/control/AphrontFormTextWithSubmitControl.php +++ b/src/view/form/control/AphrontFormTextWithSubmitControl.php @@ -3,6 +3,7 @@ final class AphrontFormTextWithSubmitControl extends AphrontFormControl { private $submitLabel; + private $readOnly; public function setSubmitLabel($submit_label) { $this->submitLabel = $submit_label; @@ -13,6 +14,15 @@ final class AphrontFormTextWithSubmitControl extends AphrontFormControl { return $this->submitLabel; } + public function setReadOnly($read_only) { + $this->readOnly = $read_only; + return $this; + } + + protected function getReadOnly() { + return $this->readOnly; + } + protected function getCustomControlClass() { return 'aphront-form-control-text-with-submit'; } @@ -37,6 +47,7 @@ final class AphrontFormTextWithSubmitControl extends AphrontFormControl { 'name' => $this->getName(), 'value' => $this->getValue(), 'disabled' => $this->getDisabled() ? 'disabled' : null, + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 'id' => $this->getID(), ))), phutil_tag( diff --git a/src/view/form/control/AphrontFormTypeaheadControl.php b/src/view/form/control/AphrontFormTypeaheadControl.php index 1e859ee132..31360d5feb 100644 --- a/src/view/form/control/AphrontFormTypeaheadControl.php +++ b/src/view/form/control/AphrontFormTypeaheadControl.php @@ -4,6 +4,7 @@ final class AphrontFormTypeaheadControl extends AphrontFormControl { private $hardpointID; private $placeholder; + private $readonly; public function setHardpointID($hardpoint_id) { $this->hardpointID = $hardpoint_id; @@ -19,6 +20,15 @@ final class AphrontFormTypeaheadControl extends AphrontFormControl { return $this; } + public function setReadOnly($read_only) { + $this->readOnly = $read_only; + return $this; + } + + protected function getReadOnly() { + return $this->readOnly; + } + protected function getCustomControlClass() { return 'aphront-form-control-typeahead'; } @@ -38,6 +48,7 @@ final class AphrontFormTypeaheadControl extends AphrontFormControl { 'value' => $this->getValue(), 'placeholder' => $this->placeholder, 'disabled' => $this->getDisabled() ? 'disabled' : null, + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 'autocomplete' => 'off', 'id' => $this->getID(), ))); diff --git a/src/view/form/control/PHUIFormFreeformDateControl.php b/src/view/form/control/PHUIFormFreeformDateControl.php index 74a32d2e0a..daf228226d 100644 --- a/src/view/form/control/PHUIFormFreeformDateControl.php +++ b/src/view/form/control/PHUIFormFreeformDateControl.php @@ -2,6 +2,17 @@ final class PHUIFormFreeformDateControl extends AphrontFormControl { + private $readOnly; + + public function setReadOnly($read_only) { + $this->readOnly = $read_only; + return $this; + } + + protected function getReadOnly() { + return $this->readOnly; + } + protected function getCustomControlClass() { return 'aphront-form-control-text'; } @@ -14,6 +25,7 @@ final class PHUIFormFreeformDateControl extends AphrontFormControl { 'name' => $this->getName(), 'value' => $this->getValue(), 'disabled' => $this->getDisabled() ? 'disabled' : null, + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 'id' => $this->getID(), )); } diff --git a/src/view/form/control/PHUIFormNumberControl.php b/src/view/form/control/PHUIFormNumberControl.php index c577bebbd0..7f976f2546 100644 --- a/src/view/form/control/PHUIFormNumberControl.php +++ b/src/view/form/control/PHUIFormNumberControl.php @@ -4,6 +4,7 @@ final class PHUIFormNumberControl extends AphrontFormControl { private $disableAutocomplete; private $autofocus; + private $readOnly; public function setDisableAutocomplete($disable_autocomplete) { $this->disableAutocomplete = $disable_autocomplete; @@ -23,6 +24,15 @@ final class PHUIFormNumberControl extends AphrontFormControl { return $this->autofocus; } + public function setReadOnly($read_only) { + $this->readOnly = $read_only; + return $this; + } + + protected function getReadOnly() { + return $this->readOnly; + } + protected function getCustomControlClass() { return 'phui-form-number'; } @@ -42,6 +52,7 @@ final class PHUIFormNumberControl extends AphrontFormControl { 'name' => $this->getName(), 'value' => $this->getValue(), 'disabled' => $this->getDisabled() ? 'disabled' : null, + 'readonly' => $this->getReadOnly() ? 'readonly' : null, 'autocomplete' => $autocomplete, 'id' => $this->getID(), 'autofocus' => ($this->getAutofocus() ? 'autofocus' : null),