Add a article limit per tag

This commit is contained in:
Kazhnuz 2025-09-10 23:25:52 +02:00
parent 44222d07e8
commit 59a3c766dc
2 changed files with 11 additions and 3 deletions

View file

@ -3,5 +3,6 @@
{
"name": "Liste des mots-clés",
"description": "Affiche tous les mots-clés sur la barre latérale."
}
},
"the-minimum-number-of-articles-per-tag":"Nombre d'article(s) minimum par mot-clé pour l'afficher"
}

View file

@ -6,7 +6,8 @@ class pluginTags extends Plugin
public function init()
{
$this->dbFields = array(
'label' => 'Tags'
'label' => 'Tags',
'minNbr' => 1
);
}
@ -20,6 +21,12 @@ class pluginTags 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('Articles') . '</label>';
$html .= '<input id="jsminNbr" class="form-control" name="minNbr" type="number" dir="auto" value="' . $this->getValue('minNbr') . '">';
$html .= '<span class="tip">' . $L->get('The minimum number of articles per tag') . '</span>';
$html .= '</div>';
return $html;
}
@ -34,7 +41,7 @@ class pluginTags extends Plugin
$html = '<nav class="plugin plugin-tags" aria-labelledby="plugin-tags-label">';
$html .= '<p class="plugin-label" id="plugin-tags-label">' . $this->getValue('label') . '</p>';
$html .= '<div class="plugin-content">';
$html .= MenuHelper::getTags(1, "flat-list");
$html .= MenuHelper::getTags($this->getValue('minNbr') ?? 1, "flat-list");
$html .= '</div>';
$html .= '</nav>';