This project is read-only.

Hiding content/zones?

Topics: Customizing Orchard
Jul 11, 2011 at 1:56 PM

I have a problem. I am using the ThemeMachine-theme as a base for a site that I am building. The issue I have is the following:

I am using a content part (based on szymods Content Authorization-module) to hide content depending on their credentials, and this works great, but when I have a widget with some content that is not supposed to be shown, that zone is still shown - as if there actually was content there - but it is empty. Just taking up space.

I've tried to see if I could add some additional verification in the layout-file for it to calculate what classes to be used. Ideally I would just want it to work just the same as ThemeMachine (hiding the zone and changing the parent div's class), but I can't figure out how.

I think the issue lies in CalcuClassify, where it finds that there is content in a zone even though the content that's to be shown is empty, but I'm stumped as how to correct it.


Here's the function, in case anyone has any idea how to modify it so that i only selects zones that have content to be rendered.

string CalcuClassify(string[] zoneNames, string classNamePrefix) 
	var zoneCounter = 0;
        var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
        return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";