Add Album selector as custom field
I want to be able to add album and image selector as as custom field to News or any other content type.
is this possible without coding , or do I have to create custom control for this?
cheers, Siggi
I think that the fields available for extending modules are in this namespace "Telerik.Sitefinity.Web.UI.Fields". You can find the "ImageField" class there, but if you try to add it it throws exception saying that the "FieldDefinitionElement" attribute is missing. Also, in the control template "Telerik.Sitefinity.Resources.Templates.Fields.ImageField.ascx" there is "alert('In process of implementation.')". So, I guess the field is not complete. I need to add image and video selector for some of the existing modules like you and I will welcome a solution from Telerik instead of taking the hard and painful path of workarounds.
Hi Sigurþór Halldórsson,
As Ivan noted, the ImageField exists in Sitefinity, but you won't be able to use it in this case. Its only role for now is in the Sitefinity backend when editing image properties.
For your specific requirement you would have to create your own FieldControl and use that when creating the custom field.
That field control would be responsible for displaying the UI for selecting an image (from a library) and saving the value (ID or image URL, whatever you prefer) as the value of the custom field. You need to inherit from the FieldControl class, and your client component should inherit from the FieldControl sitefinity client component. You can do whatever you want with the UI, but make sure to implement the get_value() and set_value() client methods, which will be called by the dialog.
We will consider including such functionality in one of the future releases, but a custom field control is the only way to go for now.
Regards,
Slavo
the Telerik team
Hi Slavo,
Can you please describe a little more that how can we make a control for our custom field? I have definition for my module`s backend and want to have a file upload control...I think I`ll need to have DefinitionElement for my use, right?
Can you please guide me a little more on this and provide a little sample or basic structure or classes required etc?
Hello Sigurþór Halldórsson,
You would need to do several things to implement a custom image selector: