I'm working on a override for com_tags List of all Tags, i want to change when clicking on the tag title the list of items (articles) will slide (accordion) instead of open in a new page. I create all the css and layout but i can't get the list for each tag.
This the layout for *._items.php:
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::_('behavior.core');
JHtml::_('formbehavior.chosen', 'select');
// Get the user object.
$user = JFactory::getUser();
// Check if user is allowed to add/edit based on tags permissions.
$canEdit = $user->authorise('core.edit', 'com_tags');
$canCreate = $user->authorise('core.create', 'com_tags');
$canEditState = $user->authorise('core.edit.state', 'com_tags');
$n = count($this->items);
?>
<div class="accordion" id="accordionTags">
<?php if ($this->items == false || $n === 0) : ?>
<p><?php echo JText::_('COM_TAGS_NO_TAGS'); ?></p>
<?php else : ?>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ((!empty($item->access)) && in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<!--Card Start -->
<div class="card">
<!-- Row Heading -->
<div id="tagRowHeading-<?php echo $i;?>" class="card-header cat-list-row<?php echo $i % 2; ?>">
<h4>
<button class="btn-btn-link" type="button" data-toggle="collapse" data-target="#collapseCard-<?php echo $i;?>" data-parent="#accordionTags" aria-expanded="false" aria-controls="collapseCard-<?php echo $i;?>">
<?php echo $this->escape($item->title); ?>
</button>
</h4>
</div>
<!-- End Card Heading -->
<!-- Card Body -->
<div id="collapseCard-<?php echo $i;?>" class="collapse" aria-labelledby="tagRowHeading-<?php echo $i;?>" data-parent="#accordionTags">
<div class="card-body">
<?php echo $this->loadTemplate('items_tag'); ?>
</div>
</div>
<!-- End Card Body -->
</div>
<!-- End card -->
<?php endif; ?>
<div class="caption">
<?php if ($this->params->get('all_tags_show_tag_description', 1)) : ?>
<span class="tag-body">
<?php echo JHtml::_('string.truncate', $item->description, $this->params->get('all_tags_tag_maximum_characters')); ?>
</span>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
And for the list of articles(loadTemplate('items_tag')):
<?php
defined('_JEXEC') or die;
JHtml::_('behavior.core');
JHtml::_('formbehavior.chosen', 'select');
$n = count($this->items);
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$articleTag = new JHelperTags;
$articleTag->getItemTags('com.content.article', $item->id);
JFactory::getDocument()->addScriptDeclaration("
var resetFilter = function() {
document.getElementById('filter-search').value = '';
}
");
?>
<div id=tagtest>
<?php echo JLayoutHelper::render('joomla.content.tags', $articleTag->itemTags); ?>
</div>
<ul>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($this->items[$i]->core_state == 0) : ?>
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
<?php else : ?>
<li class="cat-list-row<?php echo $i % 2; ?>">
<?php endif; ?>
<a href="<?php echo JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router)); ?>">
<?php echo $this->escape($item->core_title); ?>
</a>
<?php if ($item->core_state == 0) : ?>
<span class="list-published label label-warning">
<?php echo JText::_('JUNPUBLISHED'); ?>
</span>
<?php endif; ?> -->
</li>
<?php endforeach; ?>
</ul>