From 3f19ac70a582938a26cef99056f176ded64bd0ac Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 18 Sep 2013 10:12:24 -0700 Subject: [PATCH] Support captions in StandardField Summary: Support captions, so this can replace the Maniphest version. Test Plan: See screenshot. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7020 --- .../standard/PhabricatorStandardCustomField.php | 14 ++++++++++++++ .../PhabricatorStandardCustomFieldBool.php | 1 + .../PhabricatorStandardCustomFieldDate.php | 1 + .../PhabricatorStandardCustomFieldRemarkup.php | 1 + .../PhabricatorStandardCustomFieldSelect.php | 1 + .../PhabricatorStandardCustomFieldUsers.php | 1 + 6 files changed, 19 insertions(+) diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php index 0e9b1a24d6..b136e11419 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php @@ -10,6 +10,7 @@ abstract class PhabricatorStandardCustomField private $fieldConfig; private $applicationField; private $strings; + private $caption; abstract public function getFieldType(); @@ -71,6 +72,15 @@ abstract class PhabricatorStandardCustomField return $this; } + public function setCaption($caption) { + $this->caption = $caption; + return $this; + } + + public function getCaption() { + return $this->caption; + } + public function setFieldDescription($description) { $this->fieldDescription = $description; return $this; @@ -88,6 +98,9 @@ abstract class PhabricatorStandardCustomField case 'strings': $this->setStrings($value); break; + case 'caption': + $this->setCaption($value); + break; case 'type': // We set this earlier on. break; @@ -163,6 +176,7 @@ abstract class PhabricatorStandardCustomField public function renderEditControl() { return id(new AphrontFormTextControl()) ->setName($this->getFieldKey()) + ->setCaption($this->getCaption()) ->setValue($this->getFieldValue()) ->setLabel($this->getFieldName()); } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php index 23fad792ae..9b47ac1403 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php @@ -75,6 +75,7 @@ final class PhabricatorStandardCustomFieldBool public function renderEditControl() { return id(new AphrontFormCheckboxControl()) ->setLabel($this->getFieldName()) + ->setCaption($this->getCaption()) ->addCheckbox( $this->getFieldKey(), 1, diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php index 2e089e75a5..198080dc22 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php @@ -62,6 +62,7 @@ final class PhabricatorStandardCustomFieldDate ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) ->setUser($this->getViewer()) + ->setCaption($this->getCaption()) ->setAllowNull(true); $control->setValue($this->getFieldValue()); diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php index e39fc66fe1..a0a982a442 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php @@ -11,6 +11,7 @@ final class PhabricatorStandardCustomFieldRemarkup return id(new PhabricatorRemarkupControl()) ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) + ->setCaption($this->getCaption()) ->setValue($this->getFieldValue()); } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php index 665a05216f..3dd21eea1a 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php @@ -67,6 +67,7 @@ final class PhabricatorStandardCustomFieldSelect public function renderEditControl() { return id(new AphrontFormSelectControl()) ->setLabel($this->getFieldName()) + ->setCaption($this->getCaption()) ->setName($this->getFieldKey()) ->setOptions($this->getOptions()); } diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php index 135db3b1d3..7e7f0d381b 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php @@ -24,6 +24,7 @@ final class PhabricatorStandardCustomFieldUsers ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) ->setDatasource('/typeahead/common/accounts/') + ->setCaption($this->getCaption()) ->setValue($handles); $limit = $this->getFieldConfigValue('limit');