feature(posts): Added template parameter
This commit is contained in:
parent
aabe0c72d5
commit
f9cfb81079
1 changed files with 10 additions and 0 deletions
|
@ -49,6 +49,7 @@ class Post implements ArrayAccess {
|
||||||
$icon_mapping = [
|
$icon_mapping = [
|
||||||
'' => 'question',
|
'' => 'question',
|
||||||
'text/markdown' => 'markdown',
|
'text/markdown' => 'markdown',
|
||||||
|
'markdown' => 'markdown',
|
||||||
'blog' => 'markdown',
|
'blog' => 'markdown',
|
||||||
'blog_list' => 'rectangle-list',
|
'blog_list' => 'rectangle-list',
|
||||||
'directory' => 'folder',
|
'directory' => 'folder',
|
||||||
|
@ -59,6 +60,14 @@ class Post implements ArrayAccess {
|
||||||
return $icon_mapping[$type] ?? 'unknown';
|
return $icon_mapping[$type] ?? 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function _deduce_template($type) {
|
||||||
|
$template_mapping = [
|
||||||
|
'directory' => 'directory'
|
||||||
|
];
|
||||||
|
|
||||||
|
return $template_mapping[$type] ?? 'vanilla';
|
||||||
|
}
|
||||||
|
|
||||||
function __construct($post_handler, $post_data, $site_defaults) {
|
function __construct($post_handler, $post_data, $site_defaults) {
|
||||||
$this->handler = $post_handler;
|
$this->handler = $post_handler;
|
||||||
|
|
||||||
|
@ -90,6 +99,7 @@ class Post implements ArrayAccess {
|
||||||
$data['type'] ??= self::_deduce_type($post_data['path']);
|
$data['type'] ??= self::_deduce_type($post_data['path']);
|
||||||
|
|
||||||
$data['icon'] ??= self::_deduce_icon($data['type']);
|
$data['icon'] ??= self::_deduce_icon($data['type']);
|
||||||
|
$data['template'] ??= self::_deduce_template($data['type']);
|
||||||
|
|
||||||
if(isset($sql_meta['media_url'])) {
|
if(isset($sql_meta['media_url'])) {
|
||||||
$data['thumb_url'] ??= $data['media_url'];
|
$data['thumb_url'] ??= $data['media_url'];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue