Dynamic field for different provider
Hi all,
I've some questions about images:
1. How can I add a new provider for an image library to which I can add dynamic fields?
2. How can I find images based on a dynamic field? I've found some forum posts with GetValue and SetValue but this doesn't work anymore in the official release?
Regards,
Daniel
Hi Daniel,
1. Unfortunately, the current implementation of custom fields doesn't support custom providers. All other functionality in images would work with a custom provider, though. If separation of images by some condition is the only reason for creating a provider, think of some other way of distinguishing between them (tags, categories, your own taxonomy).
2. You can filter items by the value of a dynamic field through dynamic LINQ. Here's an example (I have created a custom field with name TestField and type ShortText):
var images = App.WorkWith().Images().Get().Where(@
"TestField == "
"somevalue"
" && ContentState == "
"PUBLISHED"
""
);
foreach
(var img
in
images)
Response.Write(img.Title +
"\n"
);
Okay, thanks for the explanation.
Well, I do want an album that contains some images that would have some dynamic fields that are required. Of course they shouldn't be required with other albums, so that is the issue I have now. In SF 3.7 this was possible.
Regards,
Daniel
Hi Daniel,
This scenario is not supported in 4.0. We will consider it for future implementations.
Best wishes,
Ivan Dimitrov
the Telerik team
So any other way I can achieve this? I rely quite a bit on this in different modules. I'm trying to migrate a few SF 3.7 sites to 4.0, but I'm stuck on this issue...
Any reason why this is not implemented in 4.0?
Regards,
Daniel
Hello Daniel,
The reason it is not implemented in 4.0 is that we are actually using a features which comes from OpenAccess, and we provide API for it. The dynamic fields are implemented in OpenAccess and are per type, rather on provider.
The only way to hide fields for some albums is to do in the UI level. There should be some kind of filtering there, what to be shown and what to be hidden. We may try to provide some help there as well.