- ๐ฉ๐ชGermany Rar9
Will there be a update for version 6, or is there a more compatible patch?
- ๐บ๐ธUnited States mark_fullmer Tucson
Will there be a update for version 6, or is there a more compatible patch?
Here's how I'm picturing this related to the 6.x branch of LinkIt:
1. Folks coming here should also look at โจ Allow "Linkit URL converter" filter to generate links based on the language of the current page, rather than the language of the referenced entity Postponed: needs info , which has a 6.x-applicable patch that I've confirmed does apply cleanly alongside another major 6.x patch, ๐ CKEditor 5 readiness Fixed . If that approach achieves the multilingual goals for your sites, you can use that for now.
2. If that approach does not address the multilingual use case, then yes, we should add a 6.x-compatible patch for this issue. I've attached a port of the merge request in this issue, although in my initial testing, I didn't find that it was doing the multilingual behavior I was expecting. Additional testing by the community requested!
3. It may also be appropriate to add D10 compatibility and CKEditor 5 support for the 8.x-5.x branch of LinkIt. This would be a lower priority than providing multilingual support in 6.x, however. - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I'm surprised by this issue because
\Drupal\Tests\linkit\Kernel\LinkitFilterEntityTest::testFilterEntityTranslations()
proves that this works correctly to some extent (see ๐ LinkitFilterEntityTest::testFilterEntityTranslations() does not test what it appears to test Fixed for a bug that is a test-only bug).Review
- AFAICT the proposed solution here is essentially: allow linking to a specific translation. This has big repercussions for usability: what if a site has many different translations?
-
+++ b/src/Plugin/Filter/LinkitFilter.php @@ -107,6 +117,18 @@ class LinkitFilter extends FilterBase implements ContainerFactoryPluginInterface + // Extract the langcode from each URL, if available. + // Fallback to the langcode applicable to the whole element. + $entityInternalPath = $entity->toUrl('canonical')->getInternalPath(); + $entityInternalPath = preg_replace('/\/edit$/', '', $entityInternalPath); + $langcodeFromUrl = trim(str_replace($entityInternalPath, '', $href_url["path"]), '/'); + $langcode = $this->languageManager->getLanguage($langcode) ? $langcodeFromUrl : $langcode;
AFAICT this is only necessary to accommodate the modified autocomplete + matcher logic that now shows multiple available translations? (Depending on configuration.) Even if we choose to go down that path, IMHO parsing the resulting URL is a brittle approach. This logic assumes
\Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl
is used, which is not a safe assumption.A far safer solution would be to instead set
hreflang
if the user chose a specific translation that does not match the current language.
#3041045 has similarly surprised me โ see #3041045-25: Allow "Linkit URL converter" filter to generate links based on the language of the current page, rather than the language of the referenced entity โ .
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
The solution that
media
'smedia_field_widget_single_element_form_alter()
uses:/** * Implements hook_field_widget_single_element_form_alter(). */ function media_field_widget_single_element_form_alter(&$element, FormStateInterface $form_state, $context) { // Add an attribute so that text editors plugins can pass the host entity's // language to EditorMediaDialog, allowing it to present entities in the same // language. if (!empty($element['#type']) && $element['#type'] == 'text_format') { $element['#attributes']['data-media-embed-host-entity-langcode'] = $context['items']->getLangcode(); } }
โฆ this is also what I'm doing in โจ Drastically improve the linking experience in CKEditor 5 Needs work .
- ๐บ๐ธUnited States mark_fullmer Tucson
I've updated the issue title to better capture the scope of this issue.
- ๐ซ๐ฎFinland heikkiy Oulu
I tested and I cannot apply the patch from #60 either to version 6.0.0-rc1 or dev-6.0.x c9523b1. I was updating from 6.0.0-beta4.
- last update
over 1 year ago Patch Failed to Apply - ๐ฎ๐นItaly g.rocchini
I have the same problem, and with the patch of #66 all work fine for the link managed by CKEditor.
But if I use the Linkit widget for a link field, the proble is still here.
So, here you can find my patch suggestion.Please let me know if anybody else have this problem
- ๐ซ๐ฎFinland heikkiy Oulu
The patch does not seem to apply against 6.1.2 anymore.
- Status changed to Needs review
about 1 year ago 12:06pm 17 October 2023 - last update
about 1 year ago Patch Failed to Apply - last update
about 1 year ago Patch Failed to Apply - ๐ซ๐ฎFinland heikkiy Oulu
Tested that the patch applies against 6.1.2. I think this would be fine to move to Needs review now.
- last update
about 1 year ago Composer require failure - ๐จ๐ญSwitzerland pvbergen
As D10 is only supported by 6.0.x, here's a reroll against 6.0.2
- last update
about 1 year ago Composer require failure - ๐จ๐ญSwitzerland pvbergen
Updated patch for 6.0.x to resolve warnings
- last update
about 1 year ago Composer require failure - ๐ฏ๐ดJordan mohammedOdeh
After applying patch #77, I added a file link, and an error appeared. " No link template 'canonical' found for the 'file' entity type in Drupal\Co...."
- last update
12 months ago 76 pass, 4 fail - ๐จ๐ญSwitzerland pvbergen
New patches for 6.1.2, 6.1.0 and 6.0.2 to fix warnings on empty "path" index. Includes changes from #78.
The last submitted patch, 79: 2886455-79-linkit-6.1.2-multilingual.diff, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- Status changed to Needs work
6 months ago 7:36pm 16 May 2024 - ๐จ๐ฆCanada alberto56
For anyone looking for a way to consistently reproduce this, and a workaround if you can't or prefer not to apply the patch:
```
drush si -y
cd modules/contrib
git clone https://git.drupalcode.org/project/linkit.git
cd linkit
git fetch -a
git checkout 7.x
drush en content_translation linkit
```* /admin/config/regional/language
* Add Language: French
* /admin/structure/types/manage/page
* Languager settings: Enable translation
* /node/add/page
* Title: Page in English
* Save
* /node/1/translations
* French: Add
* Title: Page en franรงais
* Save
* /admin/structure/types/manage/page/fields/add-field
* Label: Link, Type: Link
* Continue
* Save settings
* /node/1/edit
* Link: Url: /fr/node/1
* Link: Link Text: View this page in French
* SaveYou will notice now that the link links to the English version of the site.
Here is a workaround:
* composer require drupal/redirect
* drush en redirect
* /admin/config/search/redirect/add
* source path: redirect/fr/node/1
* to: http://www.example.com/fr/node/1 (where http://www.example.com is the full base URL of your site)
* language: English
* /node/1/edit
* Link: Url: /redirect/fr/node/1 - ๐บ๐ธUnited States mark_fullmer Tucson
To all followers of this issue: there is a different feature request related to multilingual capabilities that looks ready to be included in the module. If this topic is important to you in how sites use Linkit, please review โจ Allow "Linkit URL converter" filter to generate links based on the language of the current page, rather than the language of the referenced entity Postponed: needs info and leave any applicable comments. I don't see that issue as incompatible with this one, since it is implemented as a configurable option. I just want to make folks following this issue aware of that one. Thanks!
- First commit to issue fork.
- Merge request !77Draft: Rerolling 6.1.2 patch from comment #79 for 6.1.6 โ (Closed) created by JI_Gravityworks
- ๐บ๐ธUnited States JI_Gravityworks
I've decided to close my merge request for this task, because once we tested the rerolled patch we discovered that it only supplies the newest translation suggestion per node, regardless of how many translations there are of that node, as wim leers โ mentions as a potential issue in comment #63 โจ Multilingual support: Allow linking to specific translations Needs review , above. Our client's site has 15+ potential translations per node, so this solution won't work for our specific scenario.
We solved the issue with elgandoz โ 's new commit of this issue โจ Allow user to link to a page in a different language Active , which worked when applied to the 6.1.6 branch.
If I were going to put in more work on this problem, I'd put it towards Allow user to link to a page in a different language โจ Allow user to link to a page in a different language Active .