1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 03:04:09 +02:00

[ticket/17361] Move language keys to storage adapters

PHPBB-17361
This commit is contained in:
Ruben Calvo
2024-11-30 01:25:17 +01:00
parent be3966c0cb
commit a44295a1ba
6 changed files with 118 additions and 24 deletions

View File

@@ -13,8 +13,25 @@
namespace phpbb\storage\provider;
use phpbb\language\language;
class local implements provider_interface
{
/**
* @var language
*/
protected $language;
/**
* Constructor
*
* @param language $language
*/
public function __construct(language $language)
{
$this->language = $language;
}
/**
* {@inheritdoc}
*/
@@ -23,6 +40,11 @@ class local implements provider_interface
return 'local';
}
public function get_title(): string
{
return $this->language->lang('STORAGE_ADAPTER_LOCAL_NAME');
}
/**
* {@inheritdoc}
*/
@@ -38,8 +60,12 @@ class local implements provider_interface
{
return [
'path' => [
'tag' => 'input',
'type' => 'text',
'title' => $this->language->lang('STORAGE_ADAPTER_LOCAL_OPTION_PATH'),
'description' => $this->language->lang('STORAGE_ADAPTER_LOCAL_OPTION_PATH_EXPLAIN'),
'form_macro' => [
'tag' => 'input',
'type' => 'text',
],
],
];
}

View File

@@ -22,6 +22,13 @@ interface provider_interface
*/
public function get_name(): string;
/**
* Gets adapter title for acp
*
* @return string
*/
public function get_title(): string;
/**
* Gets adapter class
*
@@ -32,7 +39,67 @@ interface provider_interface
/**
* Gets adapter options
*
* @return array Configuration keys
* Example:
* public function get_options()
* {
* return [
* 'text-test' => [
* 'title' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_TEXT_TEST'),
* 'description' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_TEXT_TEST_EXPLAIN'),
* 'form_macro' => [
* 'tag' => 'input',
* 'type' => 'text',
* ],
* ],
* 'password-test' => [
* 'title' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_PASSWORD_TEST'),
* 'description' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_PASSWORD_TEST_EXPLAIN'),
* 'form_macro' => [
* 'tag' => 'input',
* 'type' => 'password',
* ],
* ],
* 'radio-test' => [
* 'title' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_RADIO_TEST'),
* 'description' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_RADIO_TEST_EXPLAIN'),
* 'form_macro' => [
* 'tag' => 'radio',
* 'buttons' => [
* [
* 'type' => 'radio',
* 'value' => '1',
* 'label' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_RADIO_TEST_LABEL_ONE'),
* ],
* [
* 'type' => 'radio',
* 'value' => '2',
* 'label' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_RADIO_TEST_LABEL_TWO'),
* ],
* ],
* ],
* ],
* 'select-test' => [
* 'title' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_SELECT_TEST'),
* 'description' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_SELECT_TEST_EXPLAIN'),
* 'form_macro' => [
* 'tag' => 'select',
* 'options' => [
* ['value' => 'one', 'label' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_SELECT_TEST_LABEL_ONE')],
* ['value' => 'two', 'label' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_SELECT_TEST_LABEL_TWO')],
* ],
* ],
* ],
* 'textarea-test' => [
* 'title' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_TEXTAREA_TEST'),
* 'description' => $this->language->lang('STORAGE_ADAPTER_DEMO_OPTION_TEXTAREA_TEST_EXPLAIN'),
* 'form_macro' => [
* 'tag' => 'textarea',
* ]
* ],
* ];
* }
*
* @return array Configuration keys
*/
public function get_options(): array;