Specialize list<string> in config
Summary: Specialize editing, display and validation of list<string> options. Test Plan: Edited, viewed and validated "environment.append-paths". Reviewers: codeblock, btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2255 Differential Revision: https://secure.phabricator.com/D4319
This commit is contained in:
@@ -226,6 +226,9 @@ final class PhabricatorConfigEditController
|
||||
case 'string':
|
||||
$set_value = (string)$value;
|
||||
break;
|
||||
case 'list<string>':
|
||||
$set_value = $request->getStrList('value');
|
||||
break;
|
||||
case 'bool':
|
||||
switch ($value) {
|
||||
case 'true':
|
||||
@@ -281,6 +284,8 @@ final class PhabricatorConfigEditController
|
||||
return $value;
|
||||
case 'bool':
|
||||
return $value ? 'true' : 'false';
|
||||
case 'list<string>':
|
||||
return implode("\n", nonempty($value, array()));
|
||||
default:
|
||||
return $this->prettyPrintJSON($value);
|
||||
}
|
||||
@@ -306,6 +311,10 @@ final class PhabricatorConfigEditController
|
||||
'false' => idx($option->getOptions(), 1),
|
||||
));
|
||||
break;
|
||||
case 'list<string>':
|
||||
$control = id(new AphrontFormTextAreaControl())
|
||||
->setCaption(pht('Separate values with newlines or commas.'));
|
||||
break;
|
||||
default:
|
||||
$control = id(new AphrontFormTextAreaControl())
|
||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
|
||||
@@ -340,7 +349,7 @@ final class PhabricatorConfigEditController
|
||||
if ($value === null) {
|
||||
$value = '<em>'.pht('(empty)').'</em>';
|
||||
} else {
|
||||
$value = phutil_escape_html($value);
|
||||
$value = nl2br(phutil_escape_html($value));
|
||||
}
|
||||
|
||||
$table[] = '<tr>';
|
||||
|
||||
Reference in New Issue
Block a user