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

[5.2] Tags: Adding associations #39140

Draft
wants to merge 13 commits into
base: 5.2-dev
Choose a base branch
from
Draft

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Nov 2, 2022

Pull Request for Issue #6687 .

Summary of Changes

Tags in Joomla have so far partial support for multilanguage capabilities and there was partial, non-working code for associations. This PR introduces associations completely, cleans up the code around this and the multilanguage features are brought up to par with the rest of the Joomla core components.

  • When multilanguage is enabled, the views in the component now only show tags and content items for the current language and *.
  • The tag_list_language_filter option was removed, since it conflicts with how multilinguality works in all of the rest of Joomla. Now it automatically behaves like the rest when multilanguage is enabled.
  • The TagModel::save() method has been largely removed and replaced with the call to AdminModel::save(). The only thing that was kept was the rebuild of the nested set structure. The old code didn't have the code for associations included and I'm pretty sure some other stuff was missing here, too.
  • Tag associations aren't just one-on-one mappings, but there are cases where you have selected more than one tag per menu item. In that case, we have to find the association for each tag individually and then create a URL out of all those associated IDs combined. If in case of multiple tag IDs a tag doesn't have an associated tag, it will use the original tag to build the new URL. This assumes that such a tag will have * as language value.
  • The branch is based on the changes from [4.3] Rewriting com_tags router #39114. Please keep that PR open as well and test them separately! These changes are pretty large and if we push this all into one giant PR, this will never get tested and merged. That would be very unfortunate, so please keep it the way it is. This PR already is gigantic.
  • The component currently does not contain the Associations toolbar button.

Testing Instructions

Please first test the general functionality of tags. This means to create a few tags in the backend both via the component and by the input field in for example articles. Assign those tags to content items, create menu items in the frontend for these tags or the the "all tags" menu item type. Surf those pages in the frontend and check if everything is displayed correctly. Also create menu items with more than one tag selected for it.

In the next step, enable multilanguage mode and mark several content items with different content languages. Mark at least one tag as from one content language, create a second tag with another content language and associate these 2 tags. Check in the frontend that a tag view only shows content matching the current language and if you click on a flag, it should redirect to the associated tag.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

I don't know what we have to change here...

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.3-dev labels Nov 2, 2022
@Hackwar Hackwar marked this pull request as ready for review November 3, 2022 09:18
@jamfx
Copy link

jamfx commented Nov 3, 2022

I have tested this item 🔴 unsuccessfully on 0d7ed82

Ok, i tried the following and didn't succeed. The Test failed at least partly.
Steps I took.

  1. Joomla Default Installation with Multilanguage Sample Data
  2. Installed German and Greek languagepacks
  3. Opened Tags and Translated Millions to Millionen for Association.
  4. now set Millions to English and Millionen to German
  5. Opened "Millions"-Tag and clicked on Associations. Now I wanted to choose Millionen and typed in "Mill" but only the item IDs showed up. I could save the IDs successfully, but after reopening nothing was shown in Associations.

I stopped the test here.
Thanks for your work so far!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39140.

@Hackwar
Copy link
Member Author

Hackwar commented Nov 9, 2022

@jamfx I did some fixes. Please test this again.

Comment on lines +29 to +31
$input = Factory::getApplication()->getInput();
$params = clone $this->state->get('params');
$assoc = Associations::isEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$input = Factory::getApplication()->getInput();
$params = clone $this->state->get('params');
$assoc = Associations::isEnabled();
$input = Factory::getApplication()->getInput();
$params = clone $this->state->get('params');
$assoc = Associations::isEnabled();

@@ -34,20 +34,7 @@

// Tags filtering based on language filter
if (($this->params->get('filter_field') === 'tag') && (Multilanguage::isEnabled())) {
$tagfilter = 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.

Remove import.

@@ -119,16 +121,7 @@ protected function getListQuery()
// Exclude the root.
$query->where($db->quoteName('a.parent_id') . ' <> 0');

// Optionally filter on language
if (empty($language)) {
$language = ComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all');
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove imports.

@@ -146,14 +147,9 @@ public static function getList(&$params)
->bind(':nullDateDown', $nullDate)
->bind(':nowDateDown', $now);

// Optionally filter on language
$language = ComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all');
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove import.

@@ -13,6 +13,7 @@
use Joomla\CMS\Component\ComponentHelper;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
use Joomla\CMS\Component\ComponentHelper;

@@ -11,6 +11,7 @@

use Joomla\CMS\Component\ComponentHelper;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
use Joomla\CMS\Component\ComponentHelper;

@Hackwar Hackwar changed the base branch from 4.3-dev to 4.4-dev March 23, 2023 10:33
@Hackwar Hackwar changed the title [4.3] Tags: Adding associations [4.4] Tags: Adding associations Mar 23, 2023
@Quy Quy removed the PR-4.3-dev label Mar 23, 2023
@laoneo
Copy link
Member

laoneo commented Mar 28, 2023

Thank you for your contribution, unfortunately the 4.4-dev branch doesn't get new features. When #40181 is merged this pr should be rebased to 5.0-dev. Thanks for understanding.

@Hackwar Hackwar changed the title [4.4] Tags: Adding associations [5.0] Tags: Adding associations Mar 28, 2023
@Hackwar Hackwar changed the base branch from 4.4-dev to 5.0-dev March 28, 2023 08:00
Hackwar and others added 2 commits March 28, 2023 10:25
…r.php

Co-authored-by: Quy <quy@nomonkeybiz.com>
@Hackwar Hackwar marked this pull request as draft March 28, 2023 08:27
@Hackwar
Copy link
Member Author

Hackwar commented Mar 28, 2023

Since I had to rebase this from 4.3 to 4.4 and now to 5.0, I first have to check all the changes here if they are still correct. Switching back to draft for now.

@richard67
Copy link
Member

Why closed? Should we reopen the original issue?

@Hackwar Hackwar reopened this Apr 18, 2023
@HLeithner HLeithner changed the base branch from 5.0-dev to 5.1-dev September 30, 2023 22:51
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.1-dev.

@Hackwar Hackwar changed the title [5.0] Tags: Adding associations [5.2] Tags: Adding associations Apr 3, 2024
@Hackwar Hackwar changed the base branch from 5.1-dev to 5.2-dev April 3, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants