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_content] - Add tags filtering based on language filter #19509

Merged
merged 4 commits into from May 28, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 30 additions & 5 deletions components/com_content/views/category/tmpl/default_articles.php
Expand Up @@ -9,13 +9,38 @@

defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Language\Multilanguage;

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

// Create some shortcuts.
$params = &$this->item->params;
$n = count($this->items);
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$params = &$this->item->params;
$n = count($this->items);
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$langFilter = false;

//Tags filtering based on language filter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space after //

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (($this->params->get('filter_field') === 'tag') && (Multilanguage::isEnabled()))
{
$tagfilter = ComponentHelper::getParams('com_tags')->get('tag_list_language_filter');

switch ($tagfilter)
{
case 'current_language' :
$langFilter = JFactory::getApplication()->getLanguage()->getTag();
break;

case 'all' :
$langFilter = false;
break;

default :
$langFilter = ComponentHelper::getParams('com_tags')->get('tag_list_language_filter');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to $langFilter = $tagfilter;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete blank line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


// Check for at least one editable article
$isEditable = false;
Expand Down Expand Up @@ -55,7 +80,7 @@
<?php else : ?>
<select name="filter_tag" id="filter_tag" onchange="document.adminForm.submit();" >
<option value=""><?php echo JText::_('JOPTION_SELECT_TAG'); ?></option>
<?php echo JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')); ?>
<?php echo JHtml::_('select.options', JHtml::_('tag.options', array('filter.published' => array(1), 'filter.language' => $langFilter), true), 'value', 'text', $this->state->get('filter.tag')); ?>
</select>
<?php endif; ?>
</div>
Expand Down