Differential D14634 Diff 35411 src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
| Show All 28 Lines | public function getValueForStorage() { | ||||
| if (!$value) { | if (!$value) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| return json_encode(array_values($value)); | return json_encode(array_values($value)); | ||||
| } | } | ||||
| public function setValueFromStorage($value) { | public function setValueFromStorage($value) { | ||||
| // NOTE: We're accepting either a JSON string (a real storage value) or | |||||
| // an array (from HTTP parameter prefilling). This is a little hacky, but | |||||
| // should hold until this can get cleaned up more thoroughly. | |||||
| // TODO: Clean this up. | |||||
| $result = array(); | $result = array(); | ||||
| if ($value) { | if (!is_array($value)) { | ||||
| $value = json_decode($value, true); | $value = json_decode($value, true); | ||||
| if (is_array($value)) { | if (is_array($value)) { | ||||
| $result = array_values($value); | $result = array_values($value); | ||||
| } | } | ||||
| } | } | ||||
| $this->setFieldValue($value); | $this->setFieldValue($value); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function readApplicationSearchValueFromRequest( | public function readApplicationSearchValueFromRequest( | ||||
| PhabricatorApplicationSearchEngine $engine, | PhabricatorApplicationSearchEngine $engine, | ||||
| AphrontRequest $request) { | AphrontRequest $request) { | ||||
| return $request->getArr($this->getFieldKey()); | return $request->getArr($this->getFieldKey()); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | protected function decodeValue($value) { | ||||
| $value = json_decode($value); | $value = json_decode($value); | ||||
| if (!is_array($value)) { | if (!is_array($value)) { | ||||
| $value = array(); | $value = array(); | ||||
| } | } | ||||
| return $value; | return $value; | ||||
| } | } | ||||
| protected function getHTTPParameterType() { | |||||
| return new AphrontPHIDListHTTPParameterType(); | |||||
| } | |||||
| } | } | ||||