diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e4f559..dda297e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ + +# [1.4.0](https://github.com/flextype-plugins/themes-admin/compare/v1.3.0...v1.4.0) (2020-08-25) + +### Features + +* **core** update code base for new Flextype 0.9.11 + # [1.3.0](https://github.com/flextype-plugins/themes-admin/compare/v1.2.0...v1.3.0) (2020-08-19) diff --git a/README.md b/README.md index 2e84822..61eae02 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Themes Admin Plugin for Flextype

-Version License Total downloads Flextype Crowdin Quality Score Discord +Version License Total downloads Flextype Crowdin Quality Score Discord

Themes Admin plugin to manage site themes for the website frontend. @@ -12,7 +12,7 @@ The following dependencies need to be installed for Themes Admin Plugin. | Item | Version | Download | |---|---|---| -| [flextype](https://github.com/flextype/flextype) | 0.9.10 | [download](https://github.com/flextype/flextype/releases) | +| [flextype](https://github.com/flextype/flextype) | 0.9.11 | [download](https://github.com/flextype/flextype/releases) | | [twig](https://github.com/flextype-plugins/twig) | >=1.0.0 | [download](https://github.com/flextype-plugins/twig/releases) | | [admin](https://github.com/flextype-plugins/icon) | >=1.0.0 | [download](https://github.com/flextype-plugins/admin/releases) | | [form](https://github.com/flextype-plugins/form) | >=1.0.0 | [download](https://github.com/flextype-plugins/form/releases) | diff --git a/app/Controllers/TemplatesController.php b/app/Controllers/TemplatesController.php index 0d7fa2e..5f83267 100644 --- a/app/Controllers/TemplatesController.php +++ b/app/Controllers/TemplatesController.php @@ -12,19 +12,14 @@ class TemplatesController { - /** - * Flextype Application - */ - protected $flextype; - /** * __construct */ - public function __construct($flextype) + public function __construct() { - $this->flextype = $flextype; + } - + /** * Index page * @@ -36,29 +31,29 @@ public function index(/** @scrutinizer ignore-unused */ Request $request, Respon // Get theme from request query params $theme = $request->getQueryParams()['theme']; - return $this->flextype->container('twig')->render( + return flextype('twig')->render( $response, 'plugins/themes-admin/templates/extends/themes/templates/index.html', [ 'menu_item' => 'themes', 'theme' => $theme, - 'templates_list' => $this->flextype->container('themes')->getTemplates($theme), - 'partials_list' => $this->flextype->container('themes')->getPartials($theme), + 'templates_list' => flextype('themes')->getTemplates($theme), + 'partials_list' => flextype('themes')->getPartials($theme), 'links' => [ 'themes' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.index'), + 'link' => flextype('router')->pathFor('admin.themes.index'), 'title' => __('themes_admin_themes'), ], 'templates' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('themes_admin_templates'), 'active' => true ], ], 'buttons' => [ 'templates_create' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.add') . '?theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.add') . '?theme=' . $theme, 'title' => __('themes_admin_create_new_template'), ], @@ -78,7 +73,7 @@ public function add(/** @scrutinizer ignore-unused */ Request $request, Response // Get theme from request query params $theme = $request->getQueryParams()['theme']; - return $this->flextype->container('twig')->render( + return flextype('twig')->render( $response, 'plugins/themes-admin/templates/extends/themes/templates/add.html', [ @@ -86,17 +81,17 @@ public function add(/** @scrutinizer ignore-unused */ Request $request, Response 'theme' => $theme, 'links' => [ 'themes' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.index'), + 'link' => flextype('router')->pathFor('admin.themes.index'), 'title' => __('themes_admin_themes'), ], 'templates' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('themes_admin_templates'), ], 'templates_add' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.add') . '?theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.add') . '?theme=' . $theme, 'title' => __('themes_admin_create_new_template'), 'active' => true ], @@ -120,26 +115,26 @@ public function addProcess(Request $request, Response $response) : Response $type = $post_data['type']; $theme = $post_data['theme']; - $file = PATH['project'] . '/themes/' . $theme . '/' . $this->_type_location($type) . $this->flextype->container('slugify')->slugify($id) . '.html'; + $file = PATH['project'] . '/themes/' . $theme . '/' . $this->_type_location($type) . flextype('slugify')->slugify($id) . '.html'; if (! Filesystem::has($file)) { if (Filesystem::write( $file, '' )) { - $this->flextype->container('flash')->addMessage('success', __('themes_admin_message_' . $type . '_created')); + flextype('flash')->addMessage('success', __('themes_admin_message_' . $type . '_created')); } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_created')); + flextype('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_created')); } } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_created')); + flextype('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_created')); } if (isset($post_data['create-and-edit'])) { - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.templates.edit') . '?theme=' . $theme . '&type=' . $type . '&id=' . $id); + return $response->withRedirect(flextype('router')->pathFor('admin.templates.edit') . '?theme=' . $theme . '&type=' . $type . '&id=' . $id); } - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme); + return $response->withRedirect(flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme); } /** @@ -154,7 +149,7 @@ public function edit(Request $request, Response $response) : Response $type = $request->getQueryParams()['type']; $theme = $request->getQueryParams()['theme']; - return $this->flextype->container('twig')->render( + return flextype('twig')->render( $response, 'plugins/themes-admin/templates/extends/themes/templates/edit.html', [ @@ -165,17 +160,17 @@ public function edit(Request $request, Response $response) : Response 'type' => ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template'), 'links' => [ 'themes' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.index'), + 'link' => flextype('router')->pathFor('admin.themes.index'), 'title' => __('themes_admin_themes'), ], 'templates' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('themes_admin_templates'), ], 'templates_editor' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.edit') . '?id=' . $request->getQueryParams()['id'] . '&type=' . ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template') . '&theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.edit') . '?id=' . $request->getQueryParams()['id'] . '&type=' . ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template') . '&theme=' . $theme, 'title' => __('admin_editor'), 'active' => true ], @@ -205,12 +200,12 @@ public function editProcess(Request $request, Response $response) : Response $type = $request->getParsedBody()['type']; if (Filesystem::write(PATH['project'] . '/themes/' . $theme . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) { - $this->flextype->container('flash')->addMessage('success', __('themes_admin_message_' . $type . '_saved')); + flextype('flash')->addMessage('success', __('themes_admin_message_' . $type . '_saved')); } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_saved')); + flextype('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_saved')); } - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.templates.edit') . '?id=' . $id . '&type=' . $type . '&theme=' . $theme); + return $response->withRedirect(flextype('router')->pathFor('admin.templates.edit') . '?id=' . $id . '&type=' . $type . '&theme=' . $theme); } /** @@ -224,7 +219,7 @@ public function rename(Request $request, Response $response) : Response // Get theme from request query params $theme = $request->getQueryParams()['theme']; - return $this->flextype->container('twig')->render( + return flextype('twig')->render( $response, 'plugins/themes-admin/templates/extends/themes/templates/rename.html', [ @@ -235,17 +230,17 @@ public function rename(Request $request, Response $response) : Response 'type_current' => ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template'), 'links' => [ 'themes' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.index'), + 'link' => flextype('router')->pathFor('admin.themes.index'), 'title' => __('themes_admin_themes'), ], 'templates' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('themes_admin_templates'), ], 'templates_rename' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.templates.rename') . '?id=' . $request->getQueryParams()['id'] . '&type=' . ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template') . '&theme=' . $theme, + 'link' => flextype('router')->pathFor('admin.templates.rename') . '?id=' . $request->getQueryParams()['id'] . '&type=' . ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template') . '&theme=' . $theme, 'title' => __('admin_rename'), 'active' => true ], @@ -266,21 +261,21 @@ public function renameProcess(Request $request, Response $response) : Response $theme = $request->getParsedBody()['theme']; $type = $request->getParsedBody()['type_current']; - if (! Filesystem::has(PATH['project'] . '/themes/' . $this->flextype->container('registry')->get('plugins.site.settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) { + if (! Filesystem::has(PATH['project'] . '/themes/' . flextype('registry')->get('plugins.site.settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) { if (Filesystem::rename( PATH['project'] . '/themes/' . $theme . '/' . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html', PATH['project'] . '/themes/' . $theme . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html' ) ) { - $this->flextype->container('flash')->addMessage('success', __('themes_admin_message_' . $type . '_renamed')); + flextype('flash')->addMessage('success', __('themes_admin_message_' . $type . '_renamed')); } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_renamed')); + flextype('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_renamed')); } } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_renamed')); + flextype('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_renamed')); } - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme); + return $response->withRedirect(flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme); } /** @@ -298,12 +293,12 @@ public function deleteProcess(Request $request, Response $response) : Response $file_path = PATH['project'] . '/themes/' . $theme . '/' . $this->_type_location($type) . $request->getParsedBody()[$type . '-id'] . '.html'; if (Filesystem::delete($file_path)) { - $this->flextype->container('flash')->addMessage('success', __('themes_admin_message_' . $type . '_deleted')); + flextype('flash')->addMessage('success', __('themes_admin_message_' . $type . '_deleted')); } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_deleted')); + flextype('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_deleted')); } - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme); + return $response->withRedirect(flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme); } /** @@ -322,12 +317,12 @@ public function duplicateProcess(Request $request, Response $response) : Respons $file_path_new = PATH['project'] . '/themes/' . $theme . '/' . $this->_type_location($type) . $request->getParsedBody()[$type . '-id'] . '-duplicate-' . date('Ymd_His') . '.html'; if (Filesystem::copy($file_path, $file_path_new)) { - $this->flextype->container('flash')->addMessage('success', __('themes_admin_message_' . $type . '_duplicated')); + flextype('flash')->addMessage('success', __('themes_admin_message_' . $type . '_duplicated')); } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_duplicated')); + flextype('flash')->addMessage('error', __('themes_admin_message_' . $type . '_was_not_duplicated')); } - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.templates.index') . '?theme=' . $theme); + return $response->withRedirect(flextype('router')->pathFor('admin.templates.index') . '?theme=' . $theme); } private function _type_location($type) diff --git a/app/Controllers/ThemesController.php b/app/Controllers/ThemesController.php index bdbfd2f..657809a 100644 --- a/app/Controllers/ThemesController.php +++ b/app/Controllers/ThemesController.php @@ -17,17 +17,12 @@ class ThemesController { - /** - * Flextype Application - */ - protected $flextype; - /** * __construct */ - public function __construct($flextype) + public function __construct() { - $this->flextype = $flextype; + } /** @@ -38,15 +33,15 @@ public function __construct($flextype) */ public function index(/** @scrutinizer ignore-unused */ Request $request, Response $response) : Response { - return $this->flextype->container('twig')->render( + return flextype('twig')->render( $response, 'plugins/themes-admin/templates/extends/themes/index.html', [ 'menu_item' => 'themes', - 'themes_list' => $this->flextype->container('registry')->get('themes'), + 'themes_list' => flextype('registry')->get('themes'), 'links' => [ 'themes' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.index'), + 'link' => flextype('router')->pathFor('admin.themes.index'), 'title' => __('themes_admin_themes'), 'active' => true ], @@ -74,17 +69,17 @@ public function activateProcess(Request $request, Response $response) : Response $post_data = $request->getParsedBody(); $custom_settings_file = PATH['project'] . '/config/plugins/site/settings.yaml'; - $custom_settings_file_data = $this->flextype->container('yaml')->decode(Filesystem::read($custom_settings_file)); + $custom_settings_file_data = flextype('yaml')->decode(Filesystem::read($custom_settings_file)); Arrays::set($custom_settings_file_data, 'theme', $post_data['theme-id']); - Filesystem::write($custom_settings_file, $this->flextype->container('yaml')->encode($custom_settings_file_data)); + Filesystem::write($custom_settings_file, flextype('yaml')->encode($custom_settings_file_data)); // clear cache - $this->flextype->container('cache')->purge('doctrine'); + flextype('cache')->purge('doctrine'); // Redirect to themes index page - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.themes.index')); + return $response->withRedirect(flextype('router')->pathFor('admin.themes.index')); } /** @@ -104,20 +99,20 @@ public function information(Request $request, Response $response) : Response // Get theme custom manifest content $custom_theme_manifest_file_content = Filesystem::read($custom_theme_manifest_file); - return $this->flextype->container('twig')->render( + return flextype('twig')->render( $response, 'plugins/themes-admin/templates/extends/themes/information.html', [ 'menu_item' => 'themes', 'id' => $id, - 'theme_manifest' => $this->flextype->container('yaml')->decode($custom_theme_manifest_file_content), + 'theme_manifest' => flextype('yaml')->decode($custom_theme_manifest_file_content), 'links' => [ 'themes' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.index'), + 'link' => flextype('router')->pathFor('admin.themes.index'), 'title' => __('themes_admin_themes'), ], 'themes_information' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.information') . '?id=' . $request->getQueryParams()['id'], + 'link' => flextype('router')->pathFor('admin.themes.information') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_information'), 'active' => true ], @@ -143,7 +138,7 @@ public function settings(Request $request, Response $response) : Response // Get theme settings content $custom_theme_settings_file_content = Filesystem::read($custom_theme_settings_file); - return $this->flextype->container('twig')->render( + return flextype('twig')->render( $response, 'plugins/themes-admin/templates/extends/themes/settings.html', [ @@ -152,11 +147,11 @@ public function settings(Request $request, Response $response) : Response 'theme_settings' => $custom_theme_settings_file_content, 'links' => [ 'themes' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.index'), + 'link' => flextype('router')->pathFor('admin.themes.index'), 'title' => __('themes_admin_themes'), ], 'themes_settings' => [ - 'link' => $this->flextype->container('router')->pathFor('admin.themes.settings') . '?id=' . $request->getQueryParams()['id'], + 'link' => flextype('router')->pathFor('admin.themes.settings') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_settings'), 'active' => true ], @@ -188,11 +183,11 @@ public function settingsProcess(Request $request, Response $response) : Response $custom_theme_settings_file = PATH['project'] . '/config/themes/' . $id . '/settings.yaml'; if (Filesystem::write($custom_theme_settings_file, $data)) { - $this->flextype->container('flash')->addMessage('success', __('themes_admin_message_theme_settings_saved')); + flextype('flash')->addMessage('success', __('themes_admin_message_theme_settings_saved')); } else { - $this->flextype->container('flash')->addMessage('error', __('themes_admin_message_theme_settings_not_saved')); + flextype('flash')->addMessage('error', __('themes_admin_message_theme_settings_not_saved')); } - return $response->withRedirect($this->flextype->container('router')->pathFor('admin.themes.settings') . '?id=' . $id); + return $response->withRedirect(flextype('router')->pathFor('admin.themes.settings') . '?id=' . $id); } } diff --git a/bootstrap.php b/bootstrap.php index 8f493a7..7111d9d 100755 --- a/bootstrap.php +++ b/bootstrap.php @@ -18,7 +18,7 @@ /** * Set base admin route */ -$admin_route = $flextype->container('registry')->get('plugins.admin.settings.route'); +$admin_route = flextype('registry')->get('plugins.admin.settings.route'); /** * Ensure vendor libraries exist diff --git a/dependencies.php b/dependencies.php index 50a7978..b16173b 100644 --- a/dependencies.php +++ b/dependencies.php @@ -21,26 +21,26 @@ use function Flextype\Component\I18n\__; // Add Admin Navigation -$flextype->container('registry')->set('plugins.admin.settings.navigation.extends.themes', ['title' => __('themes_admin_themes'),'icon' => 'fas fa-palette', 'link' => $flextype->container('router')->pathFor('admin.themes.index')]); +flextype('registry')->set('plugins.admin.settings.navigation.extends.themes', ['title' => __('themes_admin_themes'),'icon' => 'fas fa-palette', 'link' => flextype('router')->pathFor('admin.themes.index')]); // Add ThemesController -$flextype->container()['ThemesController'] = static function () use ($flextype) { - return new ThemesController($flextype); +flextype()->container()['ThemesController'] = static function () { + return new ThemesController(); }; // Add TemplatesController -$flextype->container()['TemplatesController'] = static function () use ($flextype) { - return new TemplatesController($flextype); +flextype()->container()['TemplatesController'] = static function () { + return new TemplatesController(); }; -$_flextype_menu = ($flextype->container('registry')->has('plugins.admin.settings.flextype_menu')) ? $flextype->container('registry')->get('plugins.admin.settings.flextype_menu') : []; +$_flextype_menu = (flextype('registry')->has('plugins.admin.settings.flextype_menu')) ? flextype('registry')->get('plugins.admin.settings.flextype_menu') : []; -if ($flextype->container('registry')->has('flextype.settings.url') && $flextype->container('registry')->get('flextype.settings.url') != '') { - $site_url = $flextype->container('registry')->get('flextype.settings.url'); +if (flextype('registry')->has('flextype.settings.url') && flextype('registry')->get('flextype.settings.url') != '') { + $site_url = flextype('registry')->get('flextype.settings.url'); } else { $site_url = Uri::createFromEnvironment(new Environment($_SERVER))->getBaseUrl(); } -$flextype->container('registry')->set('plugins.admin.settings.flextype_menu', +flextype('registry')->set('plugins.admin.settings.flextype_menu', array_merge($_flextype_menu, [0 => ['link' => ['url' => $site_url, 'title' => __('themes_admin_view_site'), 'is_external' => true, 'icon' => 'fas fa-globe']]])); diff --git a/plugin.yaml b/plugin.yaml index f29acce..8739167 100755 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: Themes Admin -version: 1.3.0 +version: 1.4.0 description: Themes Admin plugin to manage site themes for the website frontend. icon: fas fa-paint-brush author: @@ -11,7 +11,7 @@ bugs: https://github.com/flextype-plugins/themes-admin/issues license: MIT dependencies: - flextype: 0.9.10 + flextype: 0.9.11 twig: '>=1.0.0' admin: '>=1.0.0' form: '>=1.0.0' diff --git a/routes/web.php b/routes/web.php index 44f001b..22267ed 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,27 +5,27 @@ use Flextype\Plugin\Acl\Middlewares\AclIsUserLoggedInMiddleware; use Flextype\Plugin\Acl\Middlewares\AclIsUserLoggedInRolesInMiddleware; -$flextype->group('/' . $admin_route, function () use ($flextype) : void { +flextype()->group('/' . $admin_route, function () : void { // ThemesController - $flextype->get('/themes', 'ThemesController:index')->setName('admin.themes.index'); - $flextype->get('/themes/information', 'ThemesController:information')->setName('admin.themes.information'); - $flextype->get('/themes/settings', 'ThemesController:settings')->setName('admin.themes.settings'); - $flextype->post('/themes/settings', 'ThemesController:settingsProcess')->setName('admin.themes.settingsProcess'); - $flextype->post('/themes/activateProcess', 'ThemesController:activateProcess')->setName('admin.themes.activateProcess'); + flextype()->get('/themes', 'ThemesController:index')->setName('admin.themes.index'); + flextype()->get('/themes/information', 'ThemesController:information')->setName('admin.themes.information'); + flextype()->get('/themes/settings', 'ThemesController:settings')->setName('admin.themes.settings'); + flextype()->post('/themes/settings', 'ThemesController:settingsProcess')->setName('admin.themes.settingsProcess'); + flextype()->post('/themes/activateProcess', 'ThemesController:activateProcess')->setName('admin.themes.activateProcess'); // TemplatesController - $flextype->get('/templates', 'TemplatesController:index')->setName('admin.templates.index'); - $flextype->get('/templates/add', 'TemplatesController:add')->setName('admin.templates.add'); - $flextype->post('/templates/add', 'TemplatesController:addProcess')->setName('admin.templates.addProcess'); - $flextype->get('/templates/edit', 'TemplatesController:edit')->setName('admin.templates.edit'); - $flextype->post('/templates/edit', 'TemplatesController:editProcess')->setName('admin.templates.addProcess'); - $flextype->get('/templates/rename', 'TemplatesController:rename')->setName('admin.templates.rename'); - $flextype->post('/templates/rename', 'TemplatesController:renameProcess')->setName('admin.templates.renameProcess'); - $flextype->post('/templates/duplicate', 'TemplatesController:duplicateProcess')->setName('admin.templates.duplicateProcess'); - $flextype->post('/templates/delete', 'TemplatesController:deleteProcess')->setName('admin.templates.deleteProcess'); + flextype()->get('/templates', 'TemplatesController:index')->setName('admin.templates.index'); + flextype()->get('/templates/add', 'TemplatesController:add')->setName('admin.templates.add'); + flextype()->post('/templates/add', 'TemplatesController:addProcess')->setName('admin.templates.addProcess'); + flextype()->get('/templates/edit', 'TemplatesController:edit')->setName('admin.templates.edit'); + flextype()->post('/templates/edit', 'TemplatesController:editProcess')->setName('admin.templates.addProcess'); + flextype()->get('/templates/rename', 'TemplatesController:rename')->setName('admin.templates.rename'); + flextype()->post('/templates/rename', 'TemplatesController:renameProcess')->setName('admin.templates.renameProcess'); + flextype()->post('/templates/duplicate', 'TemplatesController:duplicateProcess')->setName('admin.templates.duplicateProcess'); + flextype()->post('/templates/delete', 'TemplatesController:deleteProcess')->setName('admin.templates.deleteProcess'); -})->add(new AclIsUserLoggedInMiddleware($flextype, ['redirect' => 'admin.accounts.login'])) - ->add(new AclIsUserLoggedInRolesInMiddleware($flextype, ['redirect' => ($flextype->container('acl')->isUserLoggedIn() ? 'admin.accounts.no-access' : 'admin.accounts.login'), +})->add(new AclIsUserLoggedInMiddleware(['redirect' => 'admin.accounts.login'])) + ->add(new AclIsUserLoggedInRolesInMiddleware(['redirect' => (flextype('acl')->isUserLoggedIn() ? 'admin.accounts.no-access' : 'admin.accounts.login'), 'roles' => 'admin'])) ->add('csrf');