Page MenuHomePhabricator

D20316.diff
No OneTemporary

D20316.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3692,6 +3692,7 @@
'PhabricatorOlderInlinesSetting' => 'applications/settings/setting/PhabricatorOlderInlinesSetting.php',
'PhabricatorOneTimeTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorOneTimeTriggerClock.php',
'PhabricatorOpcodeCacheSpec' => 'applications/cache/spec/PhabricatorOpcodeCacheSpec.php',
+ 'PhabricatorOptionExportField' => 'infrastructure/export/field/PhabricatorOptionExportField.php',
'PhabricatorOptionGroupSetting' => 'applications/settings/setting/PhabricatorOptionGroupSetting.php',
'PhabricatorOwnerPathQuery' => 'applications/owners/query/PhabricatorOwnerPathQuery.php',
'PhabricatorOwnersApplication' => 'applications/owners/application/PhabricatorOwnersApplication.php',
@@ -9687,6 +9688,7 @@
'PhabricatorOlderInlinesSetting' => 'PhabricatorSelectSetting',
'PhabricatorOneTimeTriggerClock' => 'PhabricatorTriggerClock',
'PhabricatorOpcodeCacheSpec' => 'PhabricatorCacheSpec',
+ 'PhabricatorOptionExportField' => 'PhabricatorExportField',
'PhabricatorOptionGroupSetting' => 'PhabricatorSetting',
'PhabricatorOwnerPathQuery' => 'Phobject',
'PhabricatorOwnersApplication' => 'PhabricatorApplication',
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
@@ -153,4 +153,9 @@
->setOptions($this->getOptions());
}
+ protected function newExportFieldType() {
+ return id(new PhabricatorOptionExportField())
+ ->setOptions($this->getOptions());
+ }
+
}
diff --git a/src/infrastructure/export/field/PhabricatorOptionExportField.php b/src/infrastructure/export/field/PhabricatorOptionExportField.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/field/PhabricatorOptionExportField.php
@@ -0,0 +1,47 @@
+<?php
+
+final class PhabricatorOptionExportField
+ extends PhabricatorExportField {
+
+ private $options;
+
+ public function setOptions(array $options) {
+ $this->options = $options;
+ return $this;
+ }
+
+ public function getOptions() {
+ return $this->options;
+ }
+
+ public function getNaturalValue($value) {
+ if ($value === null) {
+ return $value;
+ }
+
+ if (!strlen($value)) {
+ return null;
+ }
+
+ $options = $this->getOptions();
+
+ return array(
+ 'value' => (string)$value,
+ 'name' => (string)idx($options, $value, $value),
+ );
+ }
+
+ public function getTextValue($value) {
+ $natural_value = $this->getNaturalValue($value);
+ if ($natural_value === null) {
+ return null;
+ }
+
+ return $natural_value['name'];
+ }
+
+ public function getPHPExcelValue($value) {
+ return $this->getTextValue($value);
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Thu, May 9, 8:57 PM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277374
Default Alt Text
D20316.diff (3 KB)

Event Timeline