Create allocated Settings category constants for translation
This commit is contained in:
parent
09106ff560
commit
e2921472f8
|
|
@ -79,7 +79,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'editor' => [
|
||||
'label' => 'backend::lang.editor.menu_label',
|
||||
'description' => 'backend::lang.editor.menu_description',
|
||||
'category' => 'My Settings',
|
||||
'category' => SettingsManager::CATEGORY_MYSETTINGS,
|
||||
'icon' => 'icon-code',
|
||||
'url' => Backend::URL('backend/editorpreferences'),
|
||||
'order' => 600,
|
||||
|
|
@ -88,7 +88,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'backend_preferences' => [
|
||||
'label' => 'backend::lang.backend_preferences.menu_label',
|
||||
'description' => 'backend::lang.backend_preferences.menu_description',
|
||||
'category' => 'My Settings',
|
||||
'category' => SettingsManager::CATEGORY_MYSETTINGS,
|
||||
'icon' => 'icon-laptop',
|
||||
'class' => 'Backend\Models\BackendPreferences',
|
||||
'order' => 500,
|
||||
|
|
@ -97,7 +97,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'myaccount' => [
|
||||
'label' => 'backend::lang.myaccount.menu_label',
|
||||
'description' => 'backend::lang.myaccount.menu_description',
|
||||
'category' => 'My Settings',
|
||||
'category' => SettingsManager::CATEGORY_MYSETTINGS,
|
||||
'icon' => 'icon-user',
|
||||
'url' => Backend::URL('backend/users/myaccount'),
|
||||
'order' => 400,
|
||||
|
|
@ -107,7 +107,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'access_logs' => [
|
||||
'label' => 'backend::lang.access_log.menu_label',
|
||||
'description' => 'backend::lang.access_log.menu_description',
|
||||
'category' => 'Logs',
|
||||
'category' => SettingsManager::CATEGORY_LOGS,
|
||||
'icon' => 'icon-lock',
|
||||
'url' => Backend::url('backend/accesslogs'),
|
||||
'permissions' => ['backend.access_admin_logs'],
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'theme' => [
|
||||
'label' => 'cms::lang.theme.settings_menu',
|
||||
'description' => 'cms::lang.theme.settings_menu_description',
|
||||
'category' => 'CMS',
|
||||
'category' => SettingsManager::CATEGORY_CMS,
|
||||
'icon' => 'icon-picture-o',
|
||||
'url' => Backend::URL('cms/themes'),
|
||||
'order' => 200
|
||||
|
|
|
|||
|
|
@ -214,26 +214,10 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
*/
|
||||
SettingsManager::instance()->registerCallback(function($manager){
|
||||
$manager->registerSettingItems('October.System', [
|
||||
'mail_settings' => [
|
||||
'label' => 'system::lang.mail.menu_label',
|
||||
'description' => 'system::lang.mail.menu_description',
|
||||
'category' => 'System',
|
||||
'icon' => 'icon-envelope',
|
||||
'class' => 'System\Models\MailSettings',
|
||||
'order' => 400,
|
||||
],
|
||||
'mail_templates' => [
|
||||
'label' => 'system::lang.mail_templates.menu_label',
|
||||
'description' => 'system::lang.mail_templates.menu_description',
|
||||
'category' => 'System',
|
||||
'icon' => 'icon-envelope-square',
|
||||
'url' => Backend::url('system/mailtemplates'),
|
||||
'order' => 500,
|
||||
],
|
||||
'administrators' => [
|
||||
'label' => 'backend::lang.user.menu_label',
|
||||
'description' => 'backend::lang.user.menu_description',
|
||||
'category' => 'System',
|
||||
'category' => SettingsManager::CATEGORY_SYSTEM,
|
||||
'icon' => 'icon-users',
|
||||
'url' => Backend::url('backend/users'),
|
||||
'permissions' => ['backend.manage_users'],
|
||||
|
|
@ -242,7 +226,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'updates' => [
|
||||
'label' => 'system::lang.updates.menu_label',
|
||||
'description' => 'system::lang.updates.menu_description',
|
||||
'category' => 'System',
|
||||
'category' => SettingsManager::CATEGORY_SYSTEM,
|
||||
'icon' => 'icon-cloud-download',
|
||||
'url' => Backend::url('system/updates'),
|
||||
'permissions' => ['system.manage_updates'],
|
||||
|
|
@ -251,7 +235,7 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'event_logs' => [
|
||||
'label' => 'system::lang.event_log.menu_label',
|
||||
'description' => 'system::lang.event_log.menu_description',
|
||||
'category' => 'Logs',
|
||||
'category' => SettingsManager::CATEGORY_LOGS,
|
||||
'icon' => 'icon-exclamation-triangle',
|
||||
'url' => Backend::url('system/eventlogs'),
|
||||
'permissions' => ['system.access_event_logs'],
|
||||
|
|
@ -260,12 +244,28 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
'request_logs' => [
|
||||
'label' => 'system::lang.request_log.menu_label',
|
||||
'description' => 'system::lang.request_log.menu_description',
|
||||
'category' => 'Logs',
|
||||
'category' => SettingsManager::CATEGORY_LOGS,
|
||||
'icon' => 'icon-file-o',
|
||||
'url' => Backend::url('system/requestlogs'),
|
||||
'permissions' => ['system.access_request_logs'],
|
||||
'order' => 800
|
||||
],
|
||||
'mail_settings' => [
|
||||
'label' => 'system::lang.mail.menu_label',
|
||||
'description' => 'system::lang.mail.menu_description',
|
||||
'category' => SettingsManager::CATEGORY_MAIL,
|
||||
'icon' => 'icon-envelope',
|
||||
'class' => 'System\Models\MailSettings',
|
||||
'order' => 400,
|
||||
],
|
||||
'mail_templates' => [
|
||||
'label' => 'system::lang.mail_templates.menu_label',
|
||||
'description' => 'system::lang.mail_templates.menu_description',
|
||||
'category' => SettingsManager::CATEGORY_MAIL,
|
||||
'icon' => 'icon-envelope-square',
|
||||
'url' => Backend::url('system/mailtemplates'),
|
||||
'order' => 500,
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,22 @@ class SettingsManager
|
|||
{
|
||||
use \October\Rain\Support\Traits\Singleton;
|
||||
|
||||
/**
|
||||
* Allocated category types
|
||||
*/
|
||||
const CATEGORY_CMS = 'system::lang.system.categories.cms';
|
||||
const CATEGORY_MISC = 'system::lang.system.categories.misc';
|
||||
const CATEGORY_MAIL = 'system::lang.system.categories.mail';
|
||||
const CATEGORY_LOGS = 'system::lang.system.categories.logs';
|
||||
const CATEGORY_SHOP = 'system::lang.system.categories.shop';
|
||||
const CATEGORY_TEAM = 'system::lang.system.categories.team';
|
||||
const CATEGORY_USERS = 'system::lang.system.categories.users';
|
||||
const CATEGORY_SOCIAL = 'system::lang.system.categories.social';
|
||||
const CATEGORY_SYSTEM = 'system::lang.system.categories.system';
|
||||
const CATEGORY_EVENTS = 'system::lang.system.categories.events';
|
||||
const CATEGORY_CUSTOMERS = 'system::lang.system.categories.customers';
|
||||
const CATEGORY_MYSETTINGS = 'system::lang.system.categories.my_settings';
|
||||
|
||||
/**
|
||||
* @var array Cache of registration callbacks.
|
||||
*/
|
||||
|
|
@ -29,9 +45,19 @@ class SettingsManager
|
|||
*/
|
||||
protected $allItems;
|
||||
|
||||
/**
|
||||
* @var string Active plugin or module owner.
|
||||
*/
|
||||
protected $contextOwner;
|
||||
|
||||
/**
|
||||
* @var string Active item code.
|
||||
*/
|
||||
protected $contextItemCode;
|
||||
|
||||
/**
|
||||
* @var array Settings item defaults.
|
||||
*/
|
||||
static $itemDefaults = [
|
||||
'code' => null,
|
||||
'label' => null,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,20 @@ return [
|
|||
'system' => [
|
||||
'name' => 'System',
|
||||
'menu_label' => 'System',
|
||||
'categories' => [
|
||||
'cms' => 'CMS',
|
||||
'misc' => 'Misc',
|
||||
'logs' => 'Logs',
|
||||
'mail' => 'Mail',
|
||||
'shop' => 'Shop',
|
||||
'team' => 'Team',
|
||||
'users' => 'Users',
|
||||
'system' => 'System',
|
||||
'social' => 'Social',
|
||||
'events' => 'Events',
|
||||
'customers' => 'Customers',
|
||||
'my_settings' => 'My Settings',
|
||||
],
|
||||
],
|
||||
'plugin' => [
|
||||
'unnamed' => 'Unnamed plugin',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
$context = System\Classes\SettingsManager::instance()->getContext();
|
||||
|
||||
$collapsedGroups = explode('|',
|
||||
$collapsedGroups = explode('|',
|
||||
isset($_COOKIE['sidenav_treegroupStatus']) ? $_COOKIE['sidenav_treegroupStatus'] : null
|
||||
);
|
||||
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
?>
|
||||
<li data-group-code="<?= e($category) ?>" <?= $collapsed ? 'data-status="collapsed"' : null ?>>
|
||||
<div class="group">
|
||||
<h3><?= e($category) ?></h3>
|
||||
<h3><?= e(trans($category)) ?></h3>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
|
@ -25,9 +25,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
Loading…
Reference in New Issue