diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php index 18a7b7ea37..5a6f737ea5 100644 --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -226,6 +226,9 @@ final class PhabricatorConfigEditController case 'string': $set_value = (string)$value; break; + case 'list': + $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': + 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': + $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 = ''.pht('(empty)').''; } else { - $value = phutil_escape_html($value); + $value = nl2br(phutil_escape_html($value)); } $table[] = ''; diff --git a/src/applications/config/option/PhabricatorApplicationConfigOptions.php b/src/applications/config/option/PhabricatorApplicationConfigOptions.php index 1bcc6764d4..12e13e2cfe 100644 --- a/src/applications/config/option/PhabricatorApplicationConfigOptions.php +++ b/src/applications/config/option/PhabricatorApplicationConfigOptions.php @@ -41,6 +41,32 @@ abstract class PhabricatorApplicationConfigOptions extends Phobject { $option->getKey())); } break; + case 'list': + $valid = true; + if (!is_array($value)) { + throw new PhabricatorConfigValidationException( + pht( + "Option '%s' must be a list of strings, but value is not a ". + "an array.", + $option->getKey())); + } + if ($value && array_keys($value) != range(0, count($value) - 1)) { + throw new PhabricatorConfigValidationException( + pht( + "Option '%s' must be a list of strings, but the value is a ". + "map with unnatural keys.", + $option->getKey())); + } + foreach ($value as $v) { + if (!is_string($v)) { + throw new PhabricatorConfigValidationException( + pht( + "Option '%s' must be a list of strings, but it contains one ". + "or more non-strings.", + $option->getKey())); + } + } + break; case 'wild': default: break; diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php index f5c18367fa..301c8b50e6 100644 --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -90,7 +90,8 @@ final class PhabricatorCoreConfigOptions "'nobody'). Here you can add extra directories to the \$PATH ". "environment variable, for when these binaries are in ". "non-standard locations.")) - ->addExample('/usr/local/bin', 'Valid Setting'), + ->addExample('/usr/local/bin', pht('Add One Path')) + ->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')), ); }