[ServiceConfiguration(typeof(IContentQuery)), ServiceConfiguration(typeof(IContentSlice))]
public class EverythingSlice : ContentSliceBase<IContent>
{
public override string Name
{
get { return "Everything"; }
}
}
Override the Order property to control in which order the tabs for slices appear.
Override the HideSortOptions property and return true to hide the sort links.
[ServiceConfiguration(typeof(IContentQuery)), ServiceConfiguration(typeof(IContentSlice))]
public class CategoriesSlice : ContentSliceBase<CategoryPage>
{
public override string Name
{
get { return "Categories"; }
}
public override int Order
{
get { return 5; }
}
public override bool HideSortOptions
{
get
{
return true;
}
}
}
Override the CreateOptions property and return one or more CreateOptions.
Each option requires a name/label, a content type and a parent for the new content.
public override IEnumerable<CreateOption> CreateOptions
{
get
{
var contentType = ContentTypeRepository.Load(typeof (TagPage));
var startpage = ContentLoader.Get<StartPage>(ContentReference.StartPage);
yield return new CreateOption(contentType.LocalizedName, startpage.TagsRoot, contentType.ID);
}
}
The type argument to the base class is just the first filter.
You can add more.
protected override ITypeSearch<EditorialPageBase> Filter(
ITypeSearch<EditorialPageBase> searchRequest,
ContentQueryParameters parameters)
{
return searchRequest.Filter(x => x.Created.MatchYear(DateTime.Now.Year));
}