diff --git a/phpBB/adm/style/acp_storage.html b/phpBB/adm/style/acp_storage.html index 3dcdf7e8c3..123036b45b 100644 --- a/phpBB/adm/style/acp_storage.html +++ b/phpBB/adm/style/acp_storage.html @@ -11,24 +11,28 @@ {% for storage in STORAGES %}
{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }} -
-

{{ lang('STORAGE_SELECT_DESC') }}
-
- -
-
+
+

{{ lang('STORAGE_SELECT_DESC') }}
+
+ +
+
{% for provider in PROVIDERS if provider.is_available %}
{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }} - {{ lang('STORAGE_ADAPTER_' ~ provider.get_name | upper ~ '_NAME') }} - provider.get_options + {% for name, options in provider.get_options %} + {% set lang_name = 'STORAGE_ADAPTER_' ~ storage.get_name | upper ~ '_OPTION_' ~ name | upper %} + {% set options = options|merge({'name': storage.get_name ~ '[' ~ name ~ ']'}) %} + {{ adm_block(lang(lang_name), '', input(options)) }} + {% endfor %}
{% endfor %} diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index c7ce82632a..11df56a21c 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -48,6 +48,12 @@ services: tags: - { name: twig.extension } + template.twig.extensions.form: + class: phpbb\template\twig\extension\form + arguments: + tags: + - { name: twig.extension } + template.twig.extensions.debug: class: Twig_Extension_Debug diff --git a/phpBB/language/en/acp/storage.php b/phpBB/language/en/acp/storage.php index 7025ce8a80..04bff12bfd 100644 --- a/phpBB/language/en/acp/storage.php +++ b/phpBB/language/en/acp/storage.php @@ -46,6 +46,8 @@ $lang = array_merge($lang, array( 'STORAGE_AVATAR_TITLE' => 'Avatars storage', 'STORAGE_BACKUP_TITLE' => 'Backup storage', + 'STORAGE_ADAPTER_LOCAL_OPTION_PATH' => 'Path', + 'STORAGE_ADAPTER_LOCAL_NAME' => 'Local', )); diff --git a/phpBB/phpbb/storage/provider/local.php b/phpBB/phpbb/storage/provider/local.php index 32167d7d9c..b7f315bfea 100644 --- a/phpBB/phpbb/storage/provider/local.php +++ b/phpBB/phpbb/storage/provider/local.php @@ -38,7 +38,7 @@ class local implements provider_interface */ public function get_options() { - return ['path' => array('lang' => 'PATH', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false)]; + return ['path' => array('type' => 'text')]; } /** diff --git a/phpBB/phpbb/template/twig/extension/form.php b/phpBB/phpbb/template/twig/extension/form.php new file mode 100644 index 0000000000..00d3391f47 --- /dev/null +++ b/phpBB/phpbb/template/twig/extension/form.php @@ -0,0 +1,71 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\extension; + +// I will use this to generate forms in twig until there is something better +class form extends \Twig_Extension +{ + + /** + * Constructor + */ + public function __construct() + { + } + + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('input', '\\phpbb\\template\\twig\\extension\\form::generate_input'), + new \Twig_SimpleFunction('adm_block', '\\phpbb\\template\\twig\\extension\\form::generate_block'), + ]; + } + + public static function generate_input($options) + { + $input = ' $value) + { + if (in_array($key, ['lang'])) + continue; + + $input .= "$key=\"$value\" "; + } + break; + } + + $input .= '>'; + + return $input; + } + + public static function generate_block($name, $description = '', $content) + { + return << +

$description
+
+ $content +
+ +EOF; + } +}