Differential D12998 Diff 31352 src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
<?php | <?php | ||||
final class PhabricatorCustomFieldConfigOptionType | final class PhabricatorCustomFieldConfigOptionType | ||||
extends PhabricatorConfigOptionType { | extends PhabricatorConfigOptionType { | ||||
public function readRequest( | public function readRequest( | ||||
PhabricatorConfigOption $option, | PhabricatorConfigOption $option, | ||||
AphrontRequest $request) { | AphrontRequest $request) { | ||||
$e_value = null; | $e_value = null; | ||||
$errors = array(); | $errors = array(); | ||||
$storage_value = $request->getStr('value'); | $storage_value = $request->getStr('value'); | ||||
$in_value = phutil_json_decode($storage_value); | $in_value = phutil_json_decode($storage_value); | ||||
if (!is_array($in_value)) { | |||||
$in_value = array(); | |||||
} | |||||
// When we submit from JS, we submit a list (since maps are not guaranteed | // When we submit from JS, we submit a list (since maps are not guaranteed | ||||
// to retain order). Convert it into a map for storage (since it's far more | // to retain order). Convert it into a map for storage (since it's far more | ||||
// convenient for us elsewhere). | // convenient for us elsewhere). | ||||
$storage_value = ipull($in_value, null, 'key'); | $storage_value = ipull($in_value, null, 'key'); | ||||
$display_value = $storage_value; | $display_value = $storage_value; | ||||
return array($e_value, $errors, $storage_value, $display_value); | return array($e_value, $errors, $storage_value, $display_value); | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | public function renderControl( | ||||
} | } | ||||
$input = phutil_tag( | $input = phutil_tag( | ||||
'input', | 'input', | ||||
array( | array( | ||||
'id' => $input_id, | 'id' => $input_id, | ||||
'type' => 'hidden', | 'type' => 'hidden', | ||||
'name' => 'value', | 'name' => 'value', | ||||
'value' => json_encode($display_value), | 'value' => '', | ||||
)); | )); | ||||
Javelin::initBehavior( | Javelin::initBehavior( | ||||
'config-reorder-fields', | 'config-reorder-fields', | ||||
array( | array( | ||||
'listID' => $list_id, | 'listID' => $list_id, | ||||
'inputID' => $input_id, | 'inputID' => $input_id, | ||||
'fields' => $fields, | 'fields' => $fields, | ||||
Show All 13 Lines |