heldercervantes Posted October 18, 2021 Share Posted October 18, 2021 Is there anything as a field that allows the user to either select a page OR enter a URL? With what's available, it seems I can either give my editors a page field that doesn't allow them to point to outside URLs, or I give them a multi-language text field where they have to type the link in each individual language. This sucks. On some occations I've given both options. Page select and a multilanguage text field that overrides it. Not very elegant, sucks. Doesn't validate the URL, sucks. What would be awesome? A single field where the user either selects a page from the tree or inputs a URL with multi-language option. Also on the API, a boolean property that would easily tell if it's a page or manually entered URL that I could use to make it open in a new tab. ?⭐ Perfection!! Yeah, I know, been here long enough to know that by now I should be able to whip up a module like that. Alas, I suck. Link to comment Share on other sites More sharing options...
heldercervantes Posted October 18, 2021 Author Share Posted October 18, 2021 I found this:https://github.com/TomS-/processwire-fieldtype-assisted-url Almost there, but it doesn't handle languages ? Link to comment Share on other sites More sharing options...
horst Posted October 18, 2021 Share Posted October 18, 2021 If I remember right, in such cases I use a URL field for external URLs and a page select field for internal (multilanguage) links. If the URL field is empty, the page select field is shown, if a (external) URL is given, the page select field is hidden (showIf). (In the notes of the URL field is a hint that clearing the field will show the internal page select field). In template files I first check if there is given a URL or if that is field empty, and according to that I display external or internal URL. 2 Link to comment Share on other sites More sharing options...
heldercervantes Posted October 20, 2021 Author Share Posted October 20, 2021 On 10/18/2021 at 10:35 PM, horst said: If I remember right, in such cases I use a URL field for external URLs and a page select field for internal (multilanguage) links. If the URL field is empty, the page select field is shown, if a (external) URL is given, the page select field is hidden (showIf). (In the notes of the URL field is a hint that clearing the field will show the internal page select field). In template files I first check if there is given a URL or if that is field empty, and according to that I display external or internal URL. Yeah, that's more or less what I do. Would be cool to have something more elegant though, that wouldn't require all that configuration and conditional rendering on the frontend. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now