This project is read-only.

FilterProvider Not Being Hit

Topics: Customizing Orchard
May 30, 2011 at 12:11 AM
The below code in my Theme is never being hit.   Anyone know why?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Orchard.Mvc.Filters;

namespace Orchard
    public class LayoutFilter : FilterProvider, IResultFilter
        private readonly IWorkContextAccessor _wca;

        public LayoutFilter(IWorkContextAccessor wca)
            _wca = wca;

        public void OnResultExecuting(ResultExecutingContext filterContext)
            var workContext = _wca.GetContext();
            var routeValues = filterContext.RouteData.Values;

            if (((string)routeValues["area"]) == "HomePage")
                workContext.Layout.IsHomepage = true;

        public void OnResultExecuted(ResultExecutedContext filterContext)

May 30, 2011 at 4:34 AM

Do you have a csproj for this theme as you are providing code ?

Also, are you trying to define a layout for the homepage itself ? If so, you are aware there is a module for that, Url Alternates, which provided layout-homepage.cshtml, and also url alternates like this for everything ?

May 30, 2011 at 8:28 AM

That was it.  Still trying to get used to all these dependencies being inter-related. 

Great job on the project, really liking it.  Just need more real world examples!