Jump to content

Multi-purpose link/url FieldType


wumbo
 Share

Recommended Posts

Hi There!

When linking text using the rich text editor, you get a dialog letting you specify an external url or chose an internal page/file as link destination. I'm looking for a FieldType providing this exact behavior. With the default installation I can only chose between the URL and the Page field type. And the module repository does not provide an existing solution.

Is there a simple solution for this? Or would I have to implement my own FieldType module?

Regards,

Marco

post-3572-0-83899400-1437985887_thumb.pn

  • Like 1
Link to comment
Share on other sites

Hey Marco: This is quite funny. Johannes and me were talking about the exact same thing last week.

As far as I can tell there sadly is no such Module yet. We'd be interested in this for a project (and thought about creating a module), also.

Link to comment
Share on other sites

If i read the question right this could be solved with core fields and field dependancies...quite easy.

setup a options field with values like

1=URL

2=Intern

3=somethingElse

and a text inputfield with some HTML5 Pattern that shows up if URL is selected, a pagefield that shows up if Internal is selected.....and so on - put it in a fieldset or tab to have it glued together and the UI thing should work and is at any time easy to extend with additonal text inputs for a link CSS class or a option field for target settings....and so on.

And on the frontendside it would be a simple switch depending on the selected optionfield.

it would be work work to setup the first time but it works so far.

Or are there any benefits of a extra module?

regards mr-fan

Link to comment
Share on other sites

Hi mr-fan,

your solution could be a nice and simple workaround. The only requirement this does not meet is the possibility to link to files from other pages. 

A concrete field type that mimics the behavior of the dialog within the rich text editor would still be the best solution.

Maybe I'll find the time to inspect the code responsible for generating the rich text dialog and transfer it to a module. Then I'll be sure to drop a line and deploy it to the modules repository.

Link to comment
Share on other sites

oh your right...i've not thought about this since i use a own setup for files to have a one file == one page situation....while i'm counting access, downloads and other stuff...so i could link to my /home/documents/  files as pages very easy with an additional file field that root page is my document root page, too....

It's OT but have a look here:

https://processwire.com/talk/topic/4602-flexible-downloads-using-pages/

http://soma.urlich.ch/posts/flexible-downloads-using-pages/

best regards mr-fan

Link to comment
Share on other sites

oh and a very comfortable addition of my setup is this module....since the pagefield input's are editable directly:

https://processwire.com/talk/topic/9857-module-page-field-edit-links/

i always crack my head around the options PW great core give me as toolbox before a own module is needed...

for downloads/documents i often use the single file setup together with a PageTable field so i've a simple and easy UI for my editor to add new documents (I've a template for .pdf, .doc ....) and using tags, descriptions and if required other things, too...

Link to comment
Share on other sites

Thanks for the links. I'll certainly have a look.

In the mean time I identified the process responsible for executing the link dialog within the rich text editor: /ProcessWire/wire/modules/Process/ProcessPageEditLink

Now I'd "only" have to transfer this implementation to a FieldType module ...

Link to comment
Share on other sites

It just came to me, that I don't need to reassemble the url chooser dialog, but only the button that opens the dialog and a little bit of js surroundings.

I think, I ready-to-use module will be available in the repository soon :)

  • Like 1
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...