1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-18 19:01:40 +02:00

Admin Panel: Themes #171 #165

- next round of implementation.
This commit is contained in:
Awilum
2019-06-23 14:38:00 +03:00
parent e030dc4fea
commit 01d50aef4c

View File

@@ -18,44 +18,44 @@ use Psr\Http\Message\ServerRequestInterface as Request;
class ThemesController extends Controller
{
/**
* Index page
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function index(/** @scrutinizer ignore-unused */ Request $request, Response $response) : Response
{
$themes = [];
foreach (Filesystem::listContents(PATH['themes']) as $theme) {
if ($theme['type'] == 'dir' && Filesystem::has($theme['path'] . '/' . 'theme.json')) {
$themes[$theme['dirname']] = $theme['dirname'];
}
/**
* Index page
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function index(/** @scrutinizer ignore-unused */ Request $request, Response $response) : Response
{
$themes = [];
foreach (Filesystem::listContents(PATH['themes']) as $theme) {
if ($theme['type'] == 'dir' && Filesystem::has($theme['path'] . '/' . 'theme.json')) {
$themes[$theme['dirname']] = $theme['dirname'];
}
return $this->view->render(
$response,
'plugins/admin/views/templates/extends/themes/index.html',
[
'menu_item' => 'themes',
'themes_list' => $themes,
'links' => [
'themes' => [
'link' => $this->router->pathFor('admin.themes.index'),
'title' => __('admin_themes'),
'attributes' => ['class' => 'navbar-item active']
],
],
'buttons' => [
'templates_create' => [
'link' => $this->router->pathFor('admin.templates.add'),
'title' => __('admin_create_new_template'),
'attributes' => ['class' => 'float-right btn']
],
]
]
);
}
return $this->view->render(
$response,
'plugins/admin/views/templates/extends/themes/index.html',
[
'menu_item' => 'themes',
'themes_list' => $themes,
'links' => [
'themes' => [
'link' => $this->router->pathFor('admin.themes.index'),
'title' => __('admin_themes'),
'attributes' => ['class' => 'navbar-item active']
],
],
'buttons' => [
'templates_create' => [
'link' => $this->router->pathFor('admin.templates.add'),
'title' => __('admin_create_new_template'),
'attributes' => ['class' => 'float-right btn']
],
]
]
);
}
}