Custom Field
Hi,
Now i just start work with sitefinity and i need add a custom image o use a defult one in a post! But the difficult is that i have to create a custom field because the image don't has in the "body" of the post. the image has be in the head of the post.
Can help me someone?
Thanks and regards.
Ing. Monaco
I could create a field but now when i can't create an intances in the DB.
In my module i have this:
In LegislationManager:
ContentLinksExtensions.CopyContentLink("LegislationImage", source, destination);
In LegislationsDefinitions:
var legislationImageField = new ImageFieldElement(mainSection.Fields)
ID = "avatarField",
DataFieldName = "LegislationImage",
DisplayMode = displayMode,
UploadMode = ImageFieldUploadMode.Dialog,
Title = "LegislationImage",
WrapperTag = HtmlTextWriterTag.Li,
CssClass = "sfUserAvatar",
ResourceClassId = typeof(LegislationsResources).Name,
DataFieldType = typeof(ContentLink),
DefaultSrc = "~/SFRes/images/CCG.ContentTypes.Legislations/Images.NoLegislationImage.png",// put your default image location example:
SizeInPx = 100
;
mainSection.Fields.Add(legislationImageField);
In LegislationsResource:
[ResourceEntry("LegislationImageFieldTitle",
Value = "Legislation image",
Description = "phrase: Legislation Image Field title",
LastModified = "2011/15/06")]
public string LegislationImageFieldTitle
get return this["LegislationImageFieldTitle"];
And Finally in LegislationsModule:
if (!type.Fields.ToList().Any(fld => fld.FieldName == "LegislationImage"))
type.Fields.Add(ContentLinksExtensions.CreateContentLinkField("LegislationImage", "OpenAccessDataProvider", metaMan, RelationshipType.OneToOne));
I just add a pic with the problem.
Thanks and Regards.
I can fix this problem, now i have this Error.
i just fix the problem! thanks