This project is read-only.

Fields in Site Settings

Topics: General, Writing modules
Sep 7, 2012 at 1:08 AM
Edited Sep 7, 2012 at 1:48 AM


I have a part with two fields that are attached to the site settings in my Handler using:


Filters.Add(new ActivatingFilter<MobileAppSettingsPart>("Site"));


The part is created using migrations and fields attached to it there. However these fields don't show up when I edit the site settings. If I add a field directly to the Site content type, or create an attachable part and add it to Site, then it all works hunky dory. However, if I make the part I have attached to the site, as above, and then make the part attachable, and attach it to the Site content type, I see my MediaPickerFields twice. So I am slightly confused.

Am I just doing something wrong here? Or is this the desired effect? It is not a particularly big issue, I just kinda wanted to have the MediaPickerField, because well, it is cool. 

Any input welcome :)

Sep 12, 2012 at 6:46 PM

What's wrong with adding the fields to the Site type?

Sep 12, 2012 at 7:47 PM

Nothing really. That is what I did. I just wondered why fields I add to a part that is attached to Site in this way:


Filters.Add(new ActivatingFilter<MobileAppSettingsPart>("Site"));

, do not appear when I try to edit the site settings. Although accessing that fields value is a bit annoying either way. I did it like this (off the top of my head, cant remember the exact code): 

var bob = part.ContentItem.As<ContentPart>().Fields.FirstOrDefault(f => f.Name == "bob") as DateTimeField;


Anyway, cheers for the reply


Sep 12, 2012 at 7:53 PM

Does it work with other content types than site?

Sep 12, 2012 at 9:03 PM

I'm not sure actually. I always use Piotr's sweet code generation module to do site settings and make parts for everything else attachable. 

I will try it out when I have access to visual studio.