Update admin plugin to render with twig
This commit is contained in:
parent
2a1af73f75
commit
cb0a1917a9
4 changed files with 32 additions and 35 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
/src/Vendor/
|
||||
node_modules
|
||||
src/Cache/*
|
||||
src/config.yaml
|
||||
src/pages.yaml
|
||||
src/Config/config.yaml
|
||||
src/Config/pages.yaml
|
|
@ -125,10 +125,10 @@ class AntCMS
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><!--AntCMS-Title--></title>
|
||||
<meta name="description" content="<!--AntCMS-Description-->">
|
||||
<meta name="author" content="<!--AntCMS-Author-->">
|
||||
<meta name="keywords" content="<!--AntCMS-Keywords-->">
|
||||
<title>{{ AntCMSTitle }}</title>
|
||||
<meta name="description" content="{{ AntCMSDescription }}">
|
||||
<meta name="author" content="{{ AntCMSAuthor }}">
|
||||
<meta name="keywords" content="{{ AntCMSKeywords }}">
|
||||
</head>
|
||||
<body>
|
||||
<p>AntCMS had an error when fetching the page template, please contact the site administrator.</p>
|
||||
|
|
|
@ -7,6 +7,7 @@ use AntCMS\AntPages;
|
|||
use AntCMS\AntYaml;
|
||||
use AntCMS\AntAuth;
|
||||
use AntCMS\AntTools;
|
||||
use AntCMS\AntTwig;
|
||||
|
||||
class AdminPlugin extends AntPlugin
|
||||
{
|
||||
|
@ -30,11 +31,19 @@ class AdminPlugin extends AntPlugin
|
|||
break;
|
||||
|
||||
default:
|
||||
$antTwig = new AntTwig;
|
||||
$params = array(
|
||||
'AntCMSTitle' => 'AntCMS Admin Dashboard',
|
||||
'AntCMSDescription' => 'The AntCMS admin dashboard',
|
||||
'AntCMSAuthor' => 'AntCMS',
|
||||
'AntCMSKeywords' => 'N/A',
|
||||
);
|
||||
|
||||
$HTMLTemplate = "<h1>AntCMS Admin Plugin</h1>\n";
|
||||
$HTMLTemplate .= "<a href='//" . $currentConfig['baseURL'] . "plugin/admin/config/'>AntCMS Configuration</a><br>\n";
|
||||
$HTMLTemplate .= "<a href='//" . $currentConfig['baseURL'] . "plugin/admin/pages/'>Page management</a><br>\n";
|
||||
$pageTemplate = str_replace('<!--AntCMS-Title-->', 'AntCMS Configuration', $pageTemplate);
|
||||
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
||||
$pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
|
||||
|
||||
echo $pageTemplate;
|
||||
break;
|
||||
|
@ -53,6 +62,13 @@ class AdminPlugin extends AntPlugin
|
|||
$HTMLTemplate = $antCMS->getThemeTemplate('textarea_edit_layout');
|
||||
$currentConfig = AntConfig::currentConfig();
|
||||
$currentConfigFile = file_get_contents(antConfigFile);
|
||||
$antTwig = new AntTwig;
|
||||
$params = array(
|
||||
'AntCMSTitle' => 'AntCMS Configuration',
|
||||
'AntCMSDescription' => 'The AntCMS configuration screen',
|
||||
'AntCMSAuthor' => 'AntCMS',
|
||||
'AntCMSKeywords' => 'N/A',
|
||||
);
|
||||
|
||||
switch ($route[0] ?? 'none') {
|
||||
case 'edit':
|
||||
|
@ -91,8 +107,8 @@ class AdminPlugin extends AntPlugin
|
|||
}
|
||||
$HTMLTemplate .= "</ul>\n";
|
||||
}
|
||||
$pageTemplate = str_replace('<!--AntCMS-Title-->', 'AntCMS Configuration', $pageTemplate);
|
||||
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
||||
$pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
|
||||
|
||||
echo $pageTemplate;
|
||||
exit;
|
||||
|
@ -105,6 +121,13 @@ class AdminPlugin extends AntPlugin
|
|||
$HTMLTemplate = $antCMS->getThemeTemplate('markdown_edit_layout');
|
||||
$pages = AntPages::getPages();
|
||||
$currentConfig = AntConfig::currentConfig();
|
||||
$antTwig = new AntTwig;
|
||||
$params = array(
|
||||
'AntCMSTitle' => 'AntCMS Page Management',
|
||||
'AntCMSDescription' => 'The AntCMS page management screen',
|
||||
'AntCMSAuthor' => 'AntCMS',
|
||||
'AntCMSKeywords' => 'N/A',
|
||||
);
|
||||
|
||||
switch ($route[0] ?? 'none') {
|
||||
case 'regenerate':
|
||||
|
@ -171,8 +194,8 @@ class AdminPlugin extends AntPlugin
|
|||
$HTMLTemplate .= "</ul>\n";
|
||||
}
|
||||
|
||||
$pageTemplate = str_replace('<!--AntCMS-Title-->', 'AntCMS Page Management', $pageTemplate);
|
||||
$pageTemplate = str_replace('<!--AntCMS-Body-->', $HTMLTemplate, $pageTemplate);
|
||||
$pageTemplate = $antTwig->renderWithTiwg($pageTemplate, $params);
|
||||
|
||||
echo $pageTemplate;
|
||||
exit;
|
||||
|
|
|
@ -15,32 +15,6 @@
|
|||
crossorigin="anonymous"></script>
|
||||
|
||||
<title>{{ AntCMSTitle }}</title>
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#wrap {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
#main {
|
||||
overflow: auto;
|
||||
padding-bottom: 150px;
|
||||
/* this needs to be bigger than footer height*/
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: relative;
|
||||
margin-top: -150px;
|
||||
/* negative value of footer height */
|
||||
height: 150px;
|
||||
clear: both;
|
||||
padding-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
Loading…
Reference in a new issue