Jump to content

Inserting the URL in the body (CKEditor) for multi-lingual pages and having it automatically adapted to each language call


Recommended Posts

Posted

Preamble: Processwire is awesome and the freedom of development is quite insane. 

Issue: 

When using CKEditor and entering a URL, it says: "Enter a URL, email address, anchor, or enter word(s) to find a page."

I have installed the multilingual module, so I need to target: /en/contact/ and /de/contact/ and /lt/contact/

Adding a link to the text, I can only add one of those 3 contact links. 

When copying the text (including links) into another body (another language), then I need to edit each link to set the correct language - every time. 

Idea for solution: 

Is it possible to allow entering either: 

1. The page id (then the module could read this and create a URL), or: 

2. A placeholder for the language, e.g. "*contact" (then the module could replace the asterisk with the language identifier)

 

Thanks in advance for your ideas.

Posted

Maybe a hook could be an option. Create a module and add a hook "before save". You have to check for the field (fe. body) first. If it is the right field, then check for internal links. After that try it with a foreach loop to grab all installed languages (foreach languages as language). Here it will get tricky. Maybe you could grab the id out of the anchor? Replace the anchors by id if it is present in other languages too.

It was just a thought and I dont know how to realize this, but maybe you have an idea.

Posted

Thanks, regarding the identifier I also thought of adding the pageid directly. Something like pageid:33 within the URL should work in most cases when parsing. 

I just hoped that there is a core feature like that or an existing module. 

That would also help (when only using page ids) to prevent renaming conflicts and page 404 not found issues.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...