Extend Generic Module with custom fields
Hi,
Is there a documentation on how to extend the generic module with custom fields?
I've read somewhere you could do that, but couldn't see the documentation anywhere...
Thanks
Hello Larry,
Yes, you can do that. Please take a look at Adding custom fields to content items section in the User Guide.
If you need any further information, please do not hesitate to contact me.
All the best,
Boyan Barnev
the Telerik team
Is it possible to add custom fields to Classifications too? I'm not seeing "Custom Fields for <content type>" link in that section.
Hello Seattle Web Group,
Classifications are not content-based modules, but rather a mechanism to classify your content, and as such they do not have custom fields (a classification itself represents a dynamic field for the content item it's assigned to). Can you please share with us what's the desired functionality, I believe we might be able to come up with an advice/workaround?
Greetings,
Boyan Barnev
the Telerik team
Hi Boyan,
In addition to the description we've got some additional content that will be displayed in multiple locations that's associated with each category. Rather than having this information loosely shared through content blocks it would be ideal if the information could be entered as part of the data for the categories themselves. If there isn't an API that allows us to add custom fields to a classification then the solution will probably end up being creating a custom module that will emulate the classification functionality.
Hi,
Theoretically, you can convert almost any type to DynamicType and then add custom fields to it, so it might be possible for Taxon(the base class from which or classifications derive) as well. For example:
var metaManager = Telerik.Sitefinity.Data.Metadata.MetadataManager.GetManager();
metaManager.CreateMetaType(
typeof
(Taxon));
metaManager.SaveChanges();
App.WorkWith().DynamicData().Type(
typeof
(Taxon)).Field().TryCreateNew(
"Test"
,
typeof
(String)).SaveChanges(
true
);
var manager = TaxonomyManager.GetManager();
var myCat = manager.GetTaxa<HierarchicalTaxon>().Where(t => t.Name ==
"cat1"
).SingleOrDefault();
var testValue =
"Some value 1111"
;
myCat.SetValue(
"Test"
, testValue);
myCat.GetValue<String>(
"Test"
);
Thank You Boyan,
That's very helpful. It's going to be interesting putting the forms together for this since everything is going to need to be an LString to allow for foreign language content.
Hello,
That's a tough one, unfortunately LString is not a supported type for dynamic fields in Sitefinity, yet. We're working on implementing this functionality for some upcoming release, in the meantime you can just make a separate field for each language as a workaround.
Greetings,
Boyan Barnev
the Telerik team