Page MenuHomePhabricator

D9223.diff
No OneTemporary

D9223.diff

diff --git a/src/docs/user/configuration/custom_fields.diviner b/src/docs/user/configuration/custom_fields.diviner
--- a/src/docs/user/configuration/custom_fields.diviner
+++ b/src/docs/user/configuration/custom_fields.diviner
@@ -103,6 +103,8 @@
type. See below.
- **instructions**: Optional block of remarkup text which will appear
above the control when rendered on the edit view.
+ - **placeholder**: A placeholder text that appears on text boxes. Only
+ supported in text, int and remarkup fields (optional).
The `strings` value supports different strings per control type. They are:
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
@@ -215,13 +215,18 @@
return $this->getFieldConfigValue('instructions');
}
+ public function getPlaceholder() {
+ return $this->getFieldConfigValue('placeholder', null);
+ }
+
public function renderEditControl(array $handles) {
return id(new AphrontFormTextControl())
->setName($this->getFieldKey())
->setCaption($this->getCaption())
->setValue($this->getFieldValue())
->setError($this->getFieldError())
- ->setLabel($this->getFieldName());
+ ->setLabel($this->getFieldName())
+ ->setPlaceholder($this->getPlaceholder());
}
public function newStorageObject() {
diff --git a/src/view/form/control/AphrontFormTextControl.php b/src/view/form/control/AphrontFormTextControl.php
--- a/src/view/form/control/AphrontFormTextControl.php
+++ b/src/view/form/control/AphrontFormTextControl.php
@@ -4,18 +4,30 @@
private $disableAutocomplete;
private $sigil;
+ private $placeholder;
public function setDisableAutocomplete($disable) {
$this->disableAutocomplete = $disable;
return $this;
}
+
private function getDisableAutocomplete() {
return $this->disableAutocomplete;
}
+ public function getPlaceholder() {
+ return $this->placeholder;
+ }
+
+ public function setPlaceholder($placeholder) {
+ $this->placeholder = $placeholder;
+ return $this;
+ }
+
public function getSigil() {
return $this->sigil;
}
+
public function setSigil($sigil) {
$this->sigil = $sigil;
return $this;
@@ -36,6 +48,7 @@
'autocomplete' => $this->getDisableAutocomplete() ? 'off' : null,
'id' => $this->getID(),
'sigil' => $this->getSigil(),
+ 'placeholder' => $this->getPlaceholder()
));
}
diff --git a/webroot/rsrc/css/phui/phui-form-view.css b/webroot/rsrc/css/phui/phui-form-view.css
--- a/webroot/rsrc/css/phui/phui-form-view.css
+++ b/webroot/rsrc/css/phui/phui-form-view.css
@@ -49,6 +49,20 @@
width: 100%;
}
+.aphront-form-input *::-webkit-input-placeholder {
+ color:{$greytext} !important;
+}
+
+.aphront-form-input *::-moz-placeholder {
+ color:{$greytext} !important;
+ opacity: 1; /* Firefox nudges the opacity to 0.4 */
+}
+
+.aphront-form-input *:-ms-input-placeholder {
+ color:{$greytext} !important;
+}
+
+
.aphront-form-error {
width: 18%;
float: right;

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 4:58 PM (6 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729967
Default Alt Text
D9223.diff (3 KB)

Event Timeline