Page MenuHomePhabricator

D18041.diff
No OneTemporary

D18041.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2522,6 +2522,7 @@
'PhabricatorCustomFieldStorageQuery' => 'infrastructure/customfield/query/PhabricatorCustomFieldStorageQuery.php',
'PhabricatorCustomFieldStringIndexStorage' => 'infrastructure/customfield/storage/PhabricatorCustomFieldStringIndexStorage.php',
'PhabricatorCustomLogoConfigType' => 'applications/config/custom/PhabricatorCustomLogoConfigType.php',
+ 'PhabricatorCustomUIFooterConfigType' => 'applications/config/custom/PhabricatorCustomUIFooterConfigType.php',
'PhabricatorDaemon' => 'infrastructure/daemon/PhabricatorDaemon.php',
'PhabricatorDaemonBulkJobController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobController.php',
'PhabricatorDaemonBulkJobListController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobListController.php',
@@ -7779,6 +7780,7 @@
'PhabricatorCustomFieldStorageQuery' => 'Phobject',
'PhabricatorCustomFieldStringIndexStorage' => 'PhabricatorCustomFieldIndexStorage',
'PhabricatorCustomLogoConfigType' => 'PhabricatorConfigOptionType',
+ 'PhabricatorCustomUIFooterConfigType' => 'PhabricatorConfigJSONOptionType',
'PhabricatorDaemon' => 'PhutilDaemon',
'PhabricatorDaemonBulkJobController' => 'PhabricatorDaemonController',
'PhabricatorDaemonBulkJobListController' => 'PhabricatorDaemonBulkJobController',
diff --git a/src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php b/src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php
@@ -0,0 +1,41 @@
+<?php
+
+final class PhabricatorCustomUIFooterConfigType
+ extends PhabricatorConfigJSONOptionType {
+
+ public function validateOption(PhabricatorConfigOption $option, $value) {
+ if (!is_array($value)) {
+ throw new Exception(
+ pht(
+ 'Footer configuration is not valid: value must be a list of '.
+ 'items.'));
+ }
+
+ foreach ($value as $idx => $item) {
+ if (!is_array($item)) {
+ throw new Exception(
+ pht(
+ 'Footer item with index "%s" is invalid: each item must be a '.
+ 'dictionary describing a footer item.',
+ $idx));
+ }
+
+ try {
+ PhutilTypeSpec::checkMap(
+ $item,
+ array(
+ 'name' => 'string',
+ 'href' => 'optional string',
+ ));
+ } catch (Exception $ex) {
+ throw new Exception(
+ pht(
+ 'Footer item with index "%s" is invalid: %s',
+ $idx,
+ $ex->getMessage()));
+ }
+ }
+ }
+
+
+}
diff --git a/src/applications/config/option/PhabricatorUIConfigOptions.php b/src/applications/config/option/PhabricatorUIConfigOptions.php
--- a/src/applications/config/option/PhabricatorUIConfigOptions.php
+++ b/src/applications/config/option/PhabricatorUIConfigOptions.php
@@ -46,6 +46,7 @@
EOJSON;
$logo_type = 'custom:PhabricatorCustomLogoConfigType';
+ $footer_type = 'custom:PhabricatorCustomUIFooterConfigType';
return array(
$this->newOption('ui.header-color', 'enum', 'blindigo')
@@ -63,7 +64,7 @@
"Phabricator logo in the site header.\n\n".
" - **Wordmark**: Choose new text to display next to the logo. ".
"By default, the header displays //Phabricator//.\n\n")),
- $this->newOption('ui.footer-items', 'list<wild>', array())
+ $this->newOption('ui.footer-items', $footer_type, array())
->setSummary(
pht(
'Allows you to add footer links on most pages.'))

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 23, 6:28 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7707749
Default Alt Text
D18041.diff (3 KB)

Event Timeline