Differential D18160 Diff 43689 src/applications/config/controller/PhabricatorConfigEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/controller/PhabricatorConfigEditController.php
Show First 20 Lines • Show All 341 Lines • ▼ Show 20 Lines | if ($option->isCustomType()) { | ||||
return array($e_value, $errors, $value, $xaction); | return array($e_value, $errors, $value, $xaction); | ||||
} | } | ||||
$type = $option->getType(); | $type = $option->getType(); | ||||
$set_value = null; | $set_value = null; | ||||
switch ($type) { | switch ($type) { | ||||
case 'set': | |||||
$set_value = array_fill_keys($request->getStrList('value'), true); | |||||
break; | |||||
default: | default: | ||||
$json = json_decode($value, true); | $json = json_decode($value, true); | ||||
if ($json === null && strtolower($value) != 'null') { | if ($json === null && strtolower($value) != 'null') { | ||||
$e_value = pht('Invalid'); | $e_value = pht('Invalid'); | ||||
$errors[] = pht( | $errors[] = pht( | ||||
'The given value must be valid JSON. This means, among '. | 'The given value must be valid JSON. This means, among '. | ||||
'other things, that you must wrap strings in double-quotes.'); | 'other things, that you must wrap strings in double-quotes.'); | ||||
} else { | } else { | ||||
Show All 29 Lines | private function getDisplayValue( | ||||
if ($option->isCustomType()) { | if ($option->isCustomType()) { | ||||
return $option->getCustomObject()->getDisplayValue( | return $option->getCustomObject()->getDisplayValue( | ||||
$option, | $option, | ||||
$entry, | $entry, | ||||
$value); | $value); | ||||
} else { | } else { | ||||
$type = $option->getType(); | $type = $option->getType(); | ||||
switch ($type) { | switch ($type) { | ||||
case 'set': | |||||
return implode("\n", nonempty(array_keys($value), array())); | |||||
default: | default: | ||||
return PhabricatorConfigJSON::prettyPrintJSON($value); | return PhabricatorConfigJSON::prettyPrintJSON($value); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
private function renderControls( | private function renderControls( | ||||
PhabricatorConfigOption $option, | PhabricatorConfigOption $option, | ||||
Show All 11 Lines | private function renderControls( | ||||
if ($option->isCustomType()) { | if ($option->isCustomType()) { | ||||
$controls = $option->getCustomObject()->renderControls( | $controls = $option->getCustomObject()->renderControls( | ||||
$option, | $option, | ||||
$display_value, | $display_value, | ||||
$e_value); | $e_value); | ||||
} else { | } else { | ||||
$type = $option->getType(); | $type = $option->getType(); | ||||
switch ($type) { | switch ($type) { | ||||
case 'set': | |||||
$control = id(new AphrontFormTextAreaControl()) | |||||
->setCaption(pht('Separate values with newlines or commas.')); | |||||
break; | |||||
default: | default: | ||||
$control = id(new AphrontFormTextAreaControl()) | $control = id(new AphrontFormTextAreaControl()) | ||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) | ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) | ||||
->setCustomClass('PhabricatorMonospaced') | ->setCustomClass('PhabricatorMonospaced') | ||||
->setCaption(pht('Enter value in JSON.')); | ->setCaption(pht('Enter value in JSON.')); | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |