17

Is it possible to change the default value for the hyperlink 'Type' drop down to be 'Component' instead of 'http://'? Nine times out of ten a content editor will change this drop down to Component anyway when creating links in rich text fields.

11

I think that the way to change the default behaviour of that select is to extend the corresponding javascript of the GUI.
The code where the initialization of the link popup gets fixed is the following:

    // default to web link
    p.NewLink.type = "http://";
    p.NewLink.value = "";
    p.NewLink.href = "";

and the file is:

<'TRIDION_HOME'>\web\WebUI\Editors\CME\Views\Popups\Link\Link.js"

  • Although you are technically correct (those are the lines that set the default), I strongly recommend not changing any source files of the product. It leads to problems on upgrades and makes your installation very hard to support (as you cannot tell what you have changed that deviates from the released product). The same can be accomplished in a CME extension. – Peter Kjaer Mar 5 '13 at 13:02
7

I would do this in an extension, to avoid loss of support and upgrade issues. Then you can also share it with others who want the same feature! :)

It seems simple enough; all you would need to do is extend the existing view (Tridion.Cme.Views.Link), and in your initialize method:

  1. Call this.callBase("Tridion.Cme.View.Link", "initialize") early.
  2. Set the new values for the link (p.NewLink) and the drop-down list (c.LinkType)
  3. Call this._onTypeChange().

Of course, you should also tell Customer Support about your wishes so we can look at changing the product to support this out-of-the-box.

  • I totally agree that it's not good to change the source files. – Raúl Escudero Mar 5 '13 at 15:05
2

Raul has already given the answer.

Apart from that I want to show the exact place of the code where this LOC needs to enter on the file (Link.js)

Tridion.Cme.Views.Link.prototype.initialize = function Link$initialize()
{
    ...
    ...
    ...
    ...

    if (p.OldLink.href)
    {
        this._setUrl(p.OldLink.href);
    }
    else
    {
        // default to web link
        p.NewLink.type = "http://";
        p.NewLink.value = "";
        p.NewLink.href = "";
    }

    ...
    ...
    ...
};
  • Thanks Raúl/Siva, it seems a shame that you have to edit the javascript and it is not a configuration option. Thanks very much for your responses. – Andrew Butterworth Feb 26 '13 at 9:55
  • Yeah it is a shame that there is no extension point available for this. Please note that editing this Javascript is not a supported option. – Bart Koopman Feb 26 '13 at 14:32
  • Thanks Bart. Yes, I guess any upgrade activity would result in you losing this update anyway. Thanks everyone for your input. Much appreciated. – Andrew Butterworth Feb 27 '13 at 14:04
  • I see no reason why you could not do this in an extension. I've summarized the steps needed in my answer below. – Peter Kjaer Mar 5 '13 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.