koblog/bl-plugins/archive/plugin.php
2025-08-22 23:54:43 +02:00

53 lines
1.3 KiB
PHP

<?php
class pluginArchives extends Plugin
{
public function init()
{
$this->dbFields = array(
'label' => 'Archives',
'monthly' => false,
);
}
public function form()
{
global $L;
$html = '<div>';
$html .= '<label>' . $L->get('Label') . '</label>';
$html .= '<input id="jslabel" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
$html .= '</div>';
echo Bootstrap::formCheckbox(array(
'name' => 'monthly',
'label' => $L->g('Monthly'),
'labelForCheckbox' => $L->g('Show archives by months.'),
'placeholder' => '',
'checked' => $this->getValue('monthly'),
'tip' => ""
));
return $html;
}
public function siteSidebar()
{
global $L;
global $archives;
global $url;
$filter = $url->filters('archive');
$html = '<nav class="plugin plugin-archives" aria-labelledby="plugin-archives-title">';
$html .= '<h2 class="plugin-label" id="plugin-archives-title">' . $this->getValue('label') . '</h2>';
$html .= '<div class="plugin-content">';
$html .= MenuHelper::getArchive($this->getValue('monthly'), "flat-list");
$html .= '</div>';
$html .= '</nav>';
return $html;
}
}