Skip to content

Commit

Permalink
[Fix] Content types are not translated when displaying results of tags
Browse files Browse the repository at this point in the history
search
  • Loading branch information
infograf768 committed Oct 30, 2014
1 parent bb23762 commit e596fd6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
15 changes: 15 additions & 0 deletions administrator/language/en-GB/en-GB.plg_search_tags.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
; Note : All ini files need to be saved as UTF-8

PLG_SEARCH_TAGS="Search - Tags"
PLG_SEARCH_TAGS_CONTENT_TYPE_ARTICLE="Article"
PLG_SEARCH_TAGS_CONTENT_TYPE_ARTICLE_CATEGORY="Article Category"
PLG_SEARCH_TAGS_CONTENT_TYPE_BANNER="Banner"
PLG_SEARCH_TAGS_CONTENT_TYPE_BANNER_CLIENT="Banner Client"
PLG_SEARCH_TAGS_CONTENT_TYPE_BANNERS_CATEGORY="Banner Category"
PLG_SEARCH_TAGS_CONTENT_TYPE_CONTACT="Contact"
PLG_SEARCH_TAGS_CONTENT_TYPE_CONTACT_CATEGORY="Contact Category"
PLG_SEARCH_TAGS_CONTENT_TYPE_NEWSFEED="Newsfeed"
PLG_SEARCH_TAGS_CONTENT_TYPE_NEWSFEEDS_CATEGORY="Newsfeed Category"
PLG_SEARCH_TAGS_CONTENT_TYPE_TAG="Tag"
PLG_SEARCH_TAGS_CONTENT_TYPE_USER="User"
PLG_SEARCH_TAGS_CONTENT_TYPE_USER_NOTES="User Notes"
PLG_SEARCH_TAGS_CONTENT_TYPE_USER_NOTES_CATEGORY="User Notes Category"
PLG_SEARCH_TAGS_CONTENT_TYPE_WEBLINK="Weblink"
PLG_SEARCH_TAGS_CONTENT_TYPE_WEBLINKS_CATEGORY="Weblinks Category"
PLG_SEARCH_TAGS_FIELD_SEARCHLIMIT_DESC="Number of search items to return"
PLG_SEARCH_TAGS_FIELD_SEARCHLIMIT_LABEL="Search Limit"
PLG_SEARCH_TAGS_FIELD_SHOW_TAGGED_ITEMS_DESC="Display or not the items that hold the tags related to the search"
Expand Down
15 changes: 14 additions & 1 deletion plugins/search/tags/tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
$query = $db->getQuery(true);
$app = JFactory::getApplication();
$user = JFactory::getUser();
$lang = JFactory::getLanguage();

$section = JText::_('PLG_SEARCH_TAGS_TAGS');
$limit = $this->params->def('search_limit', 50);
Expand Down Expand Up @@ -172,11 +173,23 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
{
foreach ($tagged_items as $k => $item)
{
$type = mb_strtoupper(str_replace(' ', '_', $item->content_type_title), 'UTF-8');
$type = 'PLG_SEARCH_TAGS_CONTENT_TYPE_' . $type;

$new_item = new stdClass;
$new_item->href = $item->link;
$new_item->title = $item->core_title;
$new_item->text = $item->core_body;
$new_item->section = JText::sprintf('PLG_SEARCH_TAGS_ITEM_TAGGED_WITH', $item->content_type_title, $row->title);

if ($lang->hasKey($type))
{
$new_item->section = JText::sprintf('PLG_SEARCH_TAGS_ITEM_TAGGED_WITH', JText::_($type), $row->title);
}
else
{
$new_item->section = JText::sprintf('PLG_SEARCH_TAGS_ITEM_TAGGED_WITH', $item->content_type_title, $row->title);
}

$new_item->created = $item->displayDate;
$new_item->browsernav = 0;
$final_items[] = $new_item;
Expand Down

0 comments on commit e596fd6

Please sign in to comment.