diff --git a/administrator/components/com_k2/config.xml b/administrator/components/com_k2/config.xml
index 948d254..c81c9a0 100644
--- a/administrator/components/com_k2/config.xml
+++ b/administrator/components/com_k2/config.xml
@@ -599,6 +599,10 @@
+
+
+
+
diff --git a/administrator/components/com_k2/install.mysql.sql b/administrator/components/com_k2/install.mysql.sql
index 551350b..f874407 100644
--- a/administrator/components/com_k2/install.mysql.sql
+++ b/administrator/components/com_k2/install.mysql.sql
@@ -156,6 +156,7 @@ CREATE TABLE IF NOT EXISTS `#__k2_tags_xref` (
CREATE TABLE IF NOT EXISTS `#__k2_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(191) NOT NULL,
+ `description` text NOT NULL,
`published` smallint(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
diff --git a/administrator/components/com_k2/tables/k2tag.php b/administrator/components/com_k2/tables/k2tag.php
index ff31f0b..8f46612 100644
--- a/administrator/components/com_k2/tables/k2tag.php
+++ b/administrator/components/com_k2/tables/k2tag.php
@@ -19,9 +19,10 @@
class TableK2Tag extends K2Table
{
- var $id = null;
- var $name = null;
- var $published = null;
+ public $id = null;
+ public $name = null;
+ public $description = '';
+ public $published = null;
function __construct(&$db)
{
diff --git a/administrator/components/com_k2/views/tag/tmpl/default.php b/administrator/components/com_k2/views/tag/tmpl/default.php
index e08cce6..32d1631 100644
--- a/administrator/components/com_k2/views/tag/tmpl/default.php
+++ b/administrator/components/com_k2/views/tag/tmpl/default.php
@@ -44,6 +44,14 @@
lists['published']; ?>
+
+
+
+
+
+ editor; ?>
+
+
diff --git a/administrator/components/com_k2/views/tag/view.html.php b/administrator/components/com_k2/views/tag/view.html.php
index 9564a6a..acf3c53 100644
--- a/administrator/components/com_k2/views/tag/view.html.php
+++ b/administrator/components/com_k2/views/tag/view.html.php
@@ -10,6 +10,7 @@
// no direct access
defined('_JEXEC') or die;
+use Joomla\CMS\Editor\Editor;
use Joomla\CMS\Filter\OutputFilter;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
@@ -30,6 +31,11 @@ public function display($tpl = null)
}
$this->row = $tag;
+ $editor = Factory::getApplication()->getIdentity()->getParam('editor', 'tinymce');
+ $wysiwyg = Editor::getInstance($editor);
+ $editor = $wysiwyg->display('description', $tag->description, '100%', '350px', '', '', false);
+ $this->editor = $editor;
+
$lists = array();
$lists['published'] = HTMLHelper::_('select.booleanlist', 'published', 'class="inputbox"', $tag->published);
$this->lists = $lists;
diff --git a/administrator/language/en-GB/en-GB.com_k2.ini b/administrator/language/en-GB/en-GB.com_k2.ini
index 313bed4..b6fa3df 100644
--- a/administrator/language/en-GB/en-GB.com_k2.ini
+++ b/administrator/language/en-GB/en-GB.com_k2.ini
@@ -867,6 +867,7 @@ K2_TAG_CANNOT_BE_A_SINGLE_CHARACTER="Tag cannot be a single character"
K2_TAG_CANNOT_BE_EMPTY="Tag cannot be empty"
K2_TAG_CASE="Tag character case"
K2_TAG_NAME="Heading for tag listings"
+K2_TAG_DESCRIPTION="Tag Description"
K2_TAG_NORMALIZATION_DESC="Enabling this option will filter all tags inserted into K2 to avoid tag duplication as much as possible. For example the tag 'Extension' or 'EXTENSION' could become lowercase 'extension'. This option already includes filters for accented Latin and Greek letters but it's easy to add your own replacement pairs below."
K2_TAG_NORMALIZATION="Tag normalization"
K2_TAG_SAVED="Tag saved"
diff --git a/components/com_k2/templates/default/tag.php b/components/com_k2/templates/default/tag.php
index cd86a27..c9a10df 100644
--- a/components/com_k2/templates/default/tag.php
+++ b/components/com_k2/templates/default/tag.php
@@ -31,6 +31,11 @@ class="tagViewparams->get('pageclass_sfx')) echo ' ' . $this->p
title; ?>
+ params->get('tagDescription', 1)): ?>
+
+
description; ?>
+
+
params->get('tagFeedIcon', 1)): ?>
diff --git a/components/com_k2/views/itemlist/view.html.php b/components/com_k2/views/itemlist/view.html.php
index 0fbc6ca..4d419eb 100644
--- a/components/com_k2/views/itemlist/view.html.php
+++ b/components/com_k2/views/itemlist/view.html.php
@@ -276,7 +276,7 @@ public function display($tpl = null)
case 'tag':
// Prevent spammers from using the tag view
$tag = Factory::getApplication()->input->getString('tag');
- $db->setQuery('SELECT id, name FROM #__k2_tags WHERE name = ' . $db->quote($tag));
+ $db->setQuery('SELECT id, name, description FROM #__k2_tags WHERE name = ' . $db->quote($tag));
$tag = $db->loadObject();
if (!$tag || !$tag->id) {
jimport('joomla.filesystem.file');
@@ -315,6 +315,10 @@ public function display($tpl = null)
}
$this->title = $title;
+ // set description
+ $description = $tag->description;
+ $this->description = $description;
+
// Link
$link = K2HelperRoute::getTagRoute($tag->name);
$link = Route::_($link);
@@ -896,6 +900,10 @@ public function display($tpl = null)
}
}
+ if (!empty($tag->description)) {
+ $metaDesc = $tag->description;
+ }
+
$metaDesc = isset($metaDesc) ? trim($metaDesc) : '';
$document->setDescription(K2HelperUtilities::characterLimit($metaDesc, $params->get('metaDescLimit', 150)));
diff --git a/script.k2.php b/script.k2.php
index ff69ec8..308b036 100644
--- a/script.k2.php
+++ b/script.k2.php
@@ -345,6 +345,14 @@ public function update($type)
$db->execute();
}
+ // Tags - add description
+ $fields = $db->getTableColumns('#__k2_tags');
+ if (!array_key_exists('description', $fields)) {
+ $query = "ALTER TABLE #__k2_tags ADD `description` text NOT NULL";
+ $db->setQuery($query);
+ $db->execute();
+ }
+
// User groups (set first 2 user groups)
$query = "SELECT COUNT(*) FROM #__k2_user_groups";
$db->setQuery($query);