Page MenuHomePhabricator

D8606.id.diff
No OneTemporary

D8606.id.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
@@ -101,6 +101,8 @@
- **default**: Default field value.
- **strings**: Allows you to override specific strings based on the field
type. See below.
+ - **instructions**: Optional block of remarkup text which will appear
+ above the control when rendered on the edit view.
The `strings` value supports different strings per control type. They are:
diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php
--- a/src/infrastructure/customfield/field/PhabricatorCustomField.php
+++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php
@@ -1063,6 +1063,17 @@
/**
* @task edit
*/
+ public function getInstructionsForEdit() {
+ if ($this->proxy) {
+ return $this->proxy->getInstructionsForEdit();
+ }
+ return null;
+ }
+
+
+ /**
+ * @task edit
+ */
public function renderEditControl(array $handles) {
if ($this->proxy) {
return $this->proxy->renderEditControl($handles);
diff --git a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
--- a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
+++ b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
@@ -108,6 +108,12 @@
foreach ($enabled as $field_key => $field) {
$field_handles = array_select_keys($handles, $phids[$field_key]);
+
+ $instructions = $field->getInstructionsForEdit();
+ if (strlen($instructions)) {
+ $form->appendRemarkupInstructions($instructions);
+ }
+
$form->appendChild($field->renderEditControl($field_handles));
}
}
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
@@ -211,6 +211,10 @@
$this->setFieldValue($value);
}
+ public function getInstructionsForEdit() {
+ return $this->getFieldConfigValue('instructions');
+ }
+
public function renderEditControl(array $handles) {
return id(new AphrontFormTextControl())
->setName($this->getFieldKey())

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 23, 9:08 PM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717174
Default Alt Text
D8606.id.diff (2 KB)

Event Timeline