53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
|
|
class pluginCategories extends Plugin
|
|
{
|
|
|
|
public function init()
|
|
{
|
|
// Fields and default values for the database of this plugin
|
|
$this->dbFields = array(
|
|
'label' => 'Categories',
|
|
'hideCero' => true
|
|
);
|
|
}
|
|
|
|
// Method called on the settings of the plugin on the admin area
|
|
public function form()
|
|
{
|
|
global $L;
|
|
|
|
$html = '<div>';
|
|
$html .= '<label>' . $L->get('Label') . '</label>';
|
|
$html .= '<input 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>';
|
|
|
|
$html .= '<div>';
|
|
$html .= '<label>' . $L->get('Hide Categories without content') . '</label>';
|
|
$html .= '<select name="hideCero">';
|
|
$html .= '<option value="true" ' . ($this->getValue('hideCero') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
|
$html .= '<option value="false" ' . ($this->getValue('hideCero') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
|
$html .= '</select>';
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}
|
|
|
|
// Method called on the sidebar of the website
|
|
public function siteSidebar()
|
|
{
|
|
global $L;
|
|
global $categories;
|
|
|
|
// HTML for sidebar
|
|
$html = '<nav class="plugin plugin-categories">';
|
|
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
|
|
$html .= '<div class="plugin-content">';
|
|
$html .= MenuHelper::getCategories($this->getValue('hideCero'), true);
|
|
$html .= '</div>';
|
|
$html .= '</nav>';
|
|
|
|
return $html;
|
|
}
|
|
}
|