Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[com_tags] Tagged item link in feed #20723

Merged
merged 2 commits into from
Jun 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions components/com_tags/models/tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,14 @@ public function getItems()
{
foreach ($items as $item)
{
$explodedTypeAlias = explode('.', $item->type_alias);
$item->link = 'index.php?option=' . $explodedTypeAlias[0] . '&view=' . $explodedTypeAlias[1] . '&id='
. $item->content_item_id . ':' . $item->core_alias;
$item->link = TagsHelperRoute::getItemRoute(
$item->content_item_id,
$item->core_alias,
$item->core_catid,
$item->core_language,
$item->type_alias,
$item->router
);

// Get display date
switch ($this->state->params->get('tag_list_show_date'))
Expand Down
30 changes: 13 additions & 17 deletions components/com_tags/views/tag/tmpl/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');

JHtml::_('behavior.core');
JHtml::_('formbehavior.chosen', 'select');

Expand All @@ -22,8 +20,6 @@
$canEdit = $user->authorise('core.edit', 'com_tags');
$canCreate = $user->authorise('core.create', 'com_tags');
$canEditState = $user->authorise('core.edit.state', 'com_tags');
$items = $this->items;
$n = count($this->items);

JFactory::getDocument()->addScriptDeclaration("
var resetFilter = function() {
Expand Down Expand Up @@ -64,32 +60,32 @@
<div class="clearfix"></div>
</fieldset>
<?php endif; ?>
<?php if ($this->items === false || $n === 0) : ?>
<?php if (empty($this->items)) : ?>
<p><?php echo JText::_('COM_TAGS_NO_ITEMS'); ?></p>
<?php else : ?>
<ul class="category list-striped" itemscope itemtype="http://schema.org/ItemList">
<?php foreach ($items as $i => $item) : ?>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($item->core_state == 0) : ?>
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<?php else : ?>
<li class="cat-list-row<?php echo $i % 2; ?> clearfix" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<?php if (($item->type_alias === 'com_users.category') || ($item->type_alias === 'com_banners.category')) : ?>
<h3 itemprop="name">
<?php endif; ?>
<?php if (($item->type_alias === 'com_users.category') || ($item->type_alias === 'com_banners.category')) : ?>
<h3 itemprop="name">
<?php echo $this->escape($item->core_title); ?>
</h3>
<?php else : ?>
<h3 itemprop="name">
<a href="<?php echo JRoute::_($item->link); ?>" itemprop="url">
<?php echo $this->escape($item->core_title); ?>
</h3>
<?php else : ?>
<h3 itemprop="name">
<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)); ?>" itemprop="url">
<?php echo $this->escape($item->core_title); ?>
</a>
</h3>
<?php endif; ?>
</a>
</h3>
<?php endif; ?>
<?php // Content is generated by content plugin event "onContentAfterTitle" ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php $images = json_decode($item->core_images); ?>
<?php if ($this->params->get('tag_list_show_item_image', 1) == 1 && !empty($images->image_intro)) : ?>
<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)); ?>" itemprop="url">
<a href="<?php echo JRoute::_($item->link); ?>" itemprop="url">
<img src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>" itemprop="image">
</a>
<?php endif; ?>
Expand Down
11 changes: 4 additions & 7 deletions components/com_tags/views/tag/tmpl/list_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
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'));

Expand Down Expand Up @@ -55,7 +54,7 @@
<div class="clearfix"></div>
</fieldset>
<?php endif; ?>
<?php if ($this->items === false || $n === 0) : ?>
<?php if (empty($this->items)) : ?>
<p><?php echo JText::_('COM_TAGS_NO_ITEMS'); ?></p>
<?php else : ?>
<table class="category table table-striped table-bordered table-hover">
Expand All @@ -81,13 +80,13 @@
<?php endif; ?>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($this->items[$i]->core_state == 0) : ?>
<?php if ($item->core_state == 0) : ?>
<tr class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
<?php else : ?>
<tr class="cat-list-row<?php echo $i % 2; ?>">
<?php endif; ?>
<td <?php if ($this->params->get('show_headings')) echo "headers=\"categorylist_header_title\""; ?> class="list-title">
<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)); ?>">
<a href="<?php echo JRoute::_($item->link); ?>">
<?php echo $this->escape($item->core_title); ?>
</a>
<?php if ($item->core_state == 0) : ?>
Expand All @@ -109,9 +108,7 @@
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php // Add pagination links ?>
<?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)) : ?>
Expand Down
6 changes: 1 addition & 5 deletions components/com_tags/views/tag/view.feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public function display($tpl = null)
$title = $this->escape($item->core_title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');

// URL link to tagged item
// Change to new routing once it is merged
$link = JRoute::_($item->link);

// Strip HTML from feed item description text
$description = $item->core_body;
$author = $item->core_created_by_alias ?: $item->author;
Expand All @@ -63,7 +59,7 @@ public function display($tpl = null)
// Load individual item creator class
$feeditem = new JFeedItem;
$feeditem->title = $title;
$feeditem->link = $link;
$feeditem->link = JRoute::_($item->link);
$feeditem->description = $description;
$feeditem->date = $date;
$feeditem->category = $title;
Expand Down