What’s the best way to build this…
I have a bunch of images. It is possible that some images may be linked to some contents in the CMS and some images may link to some external links.
When rendering images through the slot, I like to be able to have slot template built the href to the appropriate URL. Now the first question is, where should the respected URLs be stored? (Should I have my own version of rffImage content type and store the associated URL there?) and the second question is, how to I build the control on the content type field such that I can select individual content item and associated it (Just like we do to insert items into a slot).
For internal Percussion CM Content, you don’t need to store the URL. You Template will generate the URL during assembly based on the JEXL bindings.
Yes, this will require a new Content Type.
The external URL should be included as a field on the Content Type; see the rffExternalLink Content Type in the FastForward implementation as an example. The field should probably be optional, given that the link my also be internal.
You will want to include a Slot for the link to the internal Content Item.
How you handle the image depends on how you use the image. If the images for these links are shared dynamic content, you will want to include a second Slot for the image. If you only use a discrete set of images, you can use a control such as a set of radio buttons or a drop list.
You can use either a single Template with internal logic to generate the final output, or create two different Templates and use a Dispatch Template to select the correct one to use to generate the final output.