Making hyperlink fields in custom content modules
Thanks for your time. Does anyone know how to make hyperlink fields for custom content modules? The use case is where i want to associated a link URL with each custom content entry, to be displayed as a hyperlink on the front end, and I may want to type it as an absolute or relative URL or alternatively select a page from within the website project somewhere, similar to how the RadEditor's hyperlink manager works. Any assistance is very much appreciated.
Hi Luke,
Typing an URL would just require a textbox, which can easily be added to a custom dynamic content type. To select a page from the website, you need to have a field control and configure the dynamic path or type of that control in the custom dynamic content type. Unfortunately there is no such field control out of the box so you need to create it yourself as explained here. I didn't manage to get it working.
Hello Arno, thanks for the reply.
I tried a different approach, I found a useful forum thread and I tried to change the DynamicModulesConfig file to render a different field type for the "Edit" and "Insert" views of my custom module. Unfortunately it didn't work, it just rendered the fields as text inputs.
The link/page selector control really should be introduced to the custom module builder field type set. If one has to crack open the source code and recompile projects in order to satisfy a pretty common use case, it is arguably incomplete as a content management system.
Hi Luke,
I agree with you 100%. Such a field control should be available, but it isn't. As far as I know there are no short term plans for it either, so I'm currently trying to have it developed.
Update: I spoke to soon. The method I described actually was partially successful.
I replaced the corresponding field in the "Edit" and "Insert" views of DynamicModulesConfig.config with a page selection field that calls PagesService.svc.
The only issue is that whatever is mapped that way doesn't resolve to any page. The generated link maps as http://(path to current location)/00000000-0000-0000-0000-000000000000 where 0=some alphanumerical character. The page service field itself has a rootNodeID attribute, perhaps it's related? (They're the same generic format but not the same value.) Clearly I'm stabbing in the dark here, though. Any help is appreciated, as a designer I will say that compiled-language web development is not my strength.
Thanks for the feedback.
Bump. Surely someone knows more about SiteFinity than I do (conservatively 99% of the community?)
Hey guys,
You can create a custom field using Thunder and use the built-in PageSelector for getting the pages.
Then you would need some custom code on the client side to get the selected value(s) to persist the data.
Kind regards,
Daniel
Hi guys,
@Luke
Because this functionality is not offered out of the box at this time I would suggest to try the solution which Arno propose. You can find and another solution in the following blog post:
Selecting Sitefinity 4 Content Inside Widget Designers
Regards,
Kaloyan
Telerik