Add global homepage presentation support

This commit is contained in:
Kazhnuz 2025-07-27 14:14:57 +02:00
parent 5b9b7bea85
commit a1f3a06164
5 changed files with 36 additions and 8 deletions

View file

@ -74,6 +74,16 @@ echo Bootstrap::formInputHidden(array(
'tip' => $L->g('you-can-add-a-site-description-to-provide')
));
echo Bootstrap::formTextarea(array(
'name' => 'homepagePresentation',
'label' => $L->g('Homepage'),
'value' => $site->homepagePresentation(),
'class' => '',
'placeholder' => '',
'tip' => '',
'rows' => 8
));
echo Bootstrap::formInputText(array(
'name' => 'footer',
'label' => $L->g('Footer text'),

View file

@ -411,6 +411,20 @@ class Theme
return $FONTAWESOME;
}
public static function getHomepagePresentation()
{
global $site;
$content = $site->homepagePresentation();
// Parse Markdown
if (MARKDOWN_PARSER) {
$parsedown = new Parsedown();
$content = $parsedown->text($content);
}
return $content;
}
public static function jsSortable($attributes = '')
{
// https://github.com/psfpro/bootstrap-html5sortable

View file

@ -6,6 +6,7 @@ class Site extends dbJSON
'title' => 'I am Guybrush Threepwood, mighty developer',
'slogan' => '',
'description' => '',
'homepagePresentation' => '',
'footer' => 'I wanna be a pirate!',
'itemsPerPage' => 6,
'language' => 'en',
@ -282,6 +283,11 @@ class Site extends dbJSON
return $this->getField('description');
}
public function homepagePresentation()
{
return $this->getField('homepagePresentation');
}
public function emailFrom()
{
return $this->getField('emailFrom');

View file

@ -6,8 +6,7 @@ class pluginAbout extends Plugin
public function init()
{
$this->dbFields = array(
'label' => 'About',
'text' => ''
'label' => 'About'
);
}
@ -21,11 +20,6 @@ class pluginAbout extends Plugin
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>' . $L->get('About') . '</label>';
$html .= '<textarea name="text" id="jstext">' . $this->getValue('text') . '</textarea>';
$html .= '</div>';
return $html;
}
@ -34,7 +28,7 @@ class pluginAbout extends Plugin
$html = '<div class="plugin plugin-about">';
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
$html .= '<div class="plugin-content">';
$html .= html_entity_decode(nl2br($this->getValue('text')));
$html .= Theme::getHomepagePresentation();
$html .= '</div>';
$html .= '</div>';

View file

@ -1,3 +1,7 @@
<?php if ($WHERE_AM_I == 'home') : ?>
<?php echo Theme::getHomepagePresentation(); ?>
<?php endif ?>
<?php if (empty($content)) : ?>
<div>
<?php $language->p('No pages found') ?>