Differential D18157 Diff 43703 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 'list<string>': | |||||
case 'list<regex>': | |||||
$set_value = phutil_split_lines( | |||||
$request->getStr('value'), | |||||
$retain_endings = false); | |||||
foreach ($set_value as $key => $v) { | |||||
if (!strlen($v)) { | |||||
unset($set_value[$key]); | |||||
} | |||||
} | |||||
$set_value = array_values($set_value); | |||||
break; | |||||
case 'set': | case 'set': | ||||
$set_value = array_fill_keys($request->getStrList('value'), true); | $set_value = array_fill_keys($request->getStrList('value'), true); | ||||
break; | break; | ||||
case 'bool': | case 'bool': | ||||
switch ($value) { | switch ($value) { | ||||
case 'true': | case 'true': | ||||
$set_value = true; | $set_value = true; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | if ($option->isCustomType()) { | ||||
$value); | $value); | ||||
} else { | } else { | ||||
$type = $option->getType(); | $type = $option->getType(); | ||||
switch ($type) { | switch ($type) { | ||||
case 'class': | case 'class': | ||||
return $value; | return $value; | ||||
case 'bool': | case 'bool': | ||||
return $value ? 'true' : 'false'; | return $value ? 'true' : 'false'; | ||||
case 'list<string>': | |||||
case 'list<regex>': | |||||
return implode("\n", nonempty($value, array())); | |||||
case 'set': | case 'set': | ||||
return implode("\n", nonempty(array_keys($value), array())); | return implode("\n", nonempty(array_keys($value), array())); | ||||
default: | default: | ||||
return PhabricatorConfigJSON::prettyPrintJSON($value); | return PhabricatorConfigJSON::prettyPrintJSON($value); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Show All 37 Lines | if ($option->isCustomType()) { | ||||
asort($names); | asort($names); | ||||
$names = array( | $names = array( | ||||
'' => pht('(Use Default)'), | '' => pht('(Use Default)'), | ||||
) + $names; | ) + $names; | ||||
$control = id(new AphrontFormSelectControl()) | $control = id(new AphrontFormSelectControl()) | ||||
->setOptions($names); | ->setOptions($names); | ||||
break; | break; | ||||
case 'list<string>': | |||||
case 'list<regex>': | |||||
$control = id(new AphrontFormTextAreaControl()) | |||||
->setCaption(pht('Separate values with newlines.')); | |||||
break; | |||||
case 'set': | case 'set': | ||||
$control = id(new AphrontFormTextAreaControl()) | $control = id(new AphrontFormTextAreaControl()) | ||||
->setCaption(pht('Separate values with newlines or commas.')); | ->setCaption(pht('Separate values with newlines or commas.')); | ||||
break; | 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') | ||||
▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |