Feature request: Link input fields

Today, when I want the web editor to add a link, I have to provide them with two fields - a ContentSelector (if they want to link to site content) and a TextLine (if they want to link to an external URL).

I would like a Link input type, which would let me do both in a single field. Then, in the portal.pageUrl() method, you could simply check if the string provided is a URL or an ID. In the former, simply return the string instead of looking up the absolute URL.

It’s cumbersome for both developers and our web editors to have two fields when you simply want one value.

Is this something you’d consider implementing?

2 Likes

What I’ve done so far is simply to create a mixin called Link that looks like this:

    <display-name>Link</display-name>
    <items>
        <input name="label" type="TextLine">
            <label>Label</label>
            <occurrences minimum="1" maximum="1"/>
        </input>
        <input name="internalLink" type="ContentSelector">
            <label>Internal link</label>
            <occurrences minimum="0" maximum="1"/>
        </input>
        <input name="externalLink" type="TextLine">
            <label>Alternatively, an external link</label>
            <occurrences minimum="0" maximum="1"/>
        </input>
    </items>
</mixin>

This way, I don’t have to repeat myself that much. But it still doesn’t look very good for our web editors.

Oh yeah, great minds think a like. I filed this as a feature request in November, and it’s been approved. Not sure when it gets into core though.

Will help a lot, I do the same many times. Adding it as a mixin was not a bad idea for improving, until now I’ve just done it old fashion copy paste way.

1 Like

I second that. I remember in 4.7 there was such a nice link feature in the htmlArea but there was no nice link input and people sometimes added htmlAreas to their content-types just for its link feature.

2 Likes

Like @bwe mentioned, we have this in the backlog. No ETA at the moment. Thanks for the request.

1 Like

+1

Any update here? The lack of this feature in 4.7 have puzzled the editors minds before… so would be a great upgrade.

The new “optionset” feature which will ship with 6.8 solves this problem!

1 Like

Yes, optionset will solve this and make it possible to create custom solutions.

For instance, create a radio button that let’s you choose “Content” or “External URL”. Selecting “Content” option will display any extra input fields you desire, while choosing “External URL” will display another set of fields. It can be just a ContentSelector for the first one, and a TextLine with a CheckBox “open in new window” for the second one.

2 Likes

Will it also be possible with the new optionset feature to do some more advanced scripting such as provide default values based on selected values or is it limited to more “static” values set in the Schema?

Hmmm, lets try to explain with an example:

Say you set the optionset to trigger when selecting a value in a ContentSelector, and then when you select a Content with ContentType A in the ContentSelector, you get a input field with default value to the name of the Content you selected.
But if you select a Content with ContentType B then that text field is blank but you will also display a checkbox?

Only static definitions will be supported for now!