created new Theme data class for theme stuff, added custom page view, added view select for page edit screen
parent
bbfe37597a
commit
a8355b2da4
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class Themes
|
||||
{
|
||||
private $themes = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$_themes = glob("../content/themes/*", GLOB_ONLYDIR);
|
||||
foreach ($_themes as $theme) {
|
||||
array_push(
|
||||
$this->themes,
|
||||
json_decode(file_get_contents($theme . "/theme.json"), true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function getThemes()
|
||||
{
|
||||
return $this->themes;
|
||||
}
|
||||
|
||||
public function getCustomViews()
|
||||
{
|
||||
$settings = (new Settings())->getSettings();
|
||||
$currentTheme = $settings["global"]["theme"];
|
||||
$folder = "../content/themes/" . $currentTheme;
|
||||
$files = array_filter(glob("$folder/*twig"), "is_file");
|
||||
$views = [];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$path = explode("/", $file);
|
||||
$fileName = $path[4];
|
||||
if (str_contains($fileName, "page")) {
|
||||
$page = explode(".", $fileName);
|
||||
$views[] = $page[0];
|
||||
}
|
||||
}
|
||||
return $views;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
{% extends "fipamo-default/frame.twig" %}
|
||||
|
||||
{% block title %}
|
||||
{{ title }}
|
||||
{% endblock %}
|
||||
|
||||
{% block mainContent %}
|
||||
<section>
|
||||
<div class="page-title">
|
||||
<span>{{title}}</span>
|
||||
</div>
|
||||
</section>
|
||||
<article>
|
||||
<div class="page">
|
||||
<p>{{content | raw}}</p>
|
||||
<div>
|
||||
|
||||
{{meta['who']}} dropped this {{ meta['when'] }}<br />
|
||||
<strong>tags: </strong>
|
||||
{% for tag in meta['tags'] %}
|
||||
{% if dynamicRender is defined %}
|
||||
{% if dynamicRender %}
|
||||
<a href="{{ "/tags/"~tag.slug }}">{{ tag.label }}</a>
|
||||
{% else %}
|
||||
<a href="{{ "/tags/"~tag.slug~".html" }}">{{ tag.label }}</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="{{ "/tags/"~tag.slug~".html" }}">{{ tag.label }}</a>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue