Problem/Motivation
When using the Pathologic module together with the Entity Cache (or in any context when the text processed by an input format is cached) I have the issue that the links in the output get printed in a wrong language.
How to reproduce
- install the Pathologic and the Entity Cache module
- add at least two languages to your site.
- configure the full html input format to use the Pathologic filter.
- create one node with an internal link in the body
- visit the node in the first language.
- visit the node in the second language: the result is that you should have the link point to the first language.
One simple solution, not sure at the moment if it is the best or not, is to just not make the pathologic filter cacheable, so in the pathologic_filter_info() we have to add:
cache => FALSE
This solves the issue, the problem is that I can imagine (for example when you do not have a multilanguage site) cases when leaving the cache to TRUE will work. So, the other option would be maybe to have a configuration so that we can choose from the backend UI if we want to disable the cache or not.
Not sure if this should be a bug or a feature request... I see it more like a bug, because it can really generate wrong links sometimes.
Related in a way to this issue too: https://www.drupal.org/node/1851430
Comment | File | Size | Author |
---|---|---|---|
#3 | pathlogic-disable-caching-2512174-3.patch | 447 bytes | lathan |
Comments
Comment #1
Nodz CreditAttribution: Nodz commentedI'm running into a similar problem on a multilingual site (but without even having Entity Cache) I tried adding
'cache' => FALSE
But I couldn't get it to work. Do you have any details on how you got it running with that?
Here's an example of the problem: I have 1 node with 2 translations:
They're linked in text from another also translated node (let's call it test node) but only using the relative node path. With pathologic (after manually clearing the cache) i get:
But if I edit Test node in en and save it then I end up with the following conversions:
The last one i even link directly the alias but it just links it to the wrong language. It could be a different problem all together but it seems to be related to the same issue.
For now I have to clear the cache every time i save a node to get the urls to generate correctly.
Comment #2
vasi1186 CreditAttribution: vasi1186 at Amazee Labs commentedWhat it is important is that the 'cache' column in the filter_format table to be 0 for your format. This is not updated during a cache clear. You should go to the filter formats admin page and just submit the form. This should update the data in the filter_format table.
Comment #3
lathanWe had this issue as well.
When Drupal is multilingual and has language fallback setup. Create a node, then do not translate the second node. The links with in the page will always be rendered with the incorrect local prefix. If you visit the page in one language then another, it will cache the first instance.
Here is a patch, note it is required to resave each input format after applying the patch.