Fixes: #U4-1695

This commit is contained in:
Shannon Deminick
2013-02-19 02:22:00 +06:00
parent b45f6e0393
commit 36cadf39e9
2 changed files with 11 additions and 5 deletions

View File

@@ -308,16 +308,18 @@ namespace Umbraco.Web
Mandate.ParameterNotNull(surfaceType, "surfaceType");
var area = Umbraco.Core.Configuration.GlobalSettings.UmbracoMvcArea;
var surfaceController = SurfaceControllerResolver.Current.SurfaceControllers
.SingleOrDefault(x => x.Metadata.ControllerType == surfaceType);
var surfaceController = SurfaceControllerResolver.Current.RegisteredSurfaceControllers
.SingleOrDefault(x => x == surfaceType);
if (surfaceController == null)
throw new InvalidOperationException("Could not find the surface controller of type " + surfaceType.FullName);
if (!surfaceController.Metadata.AreaName.IsNullOrWhiteSpace())
var metaData = PluginController.GetMetadata(surfaceController);
if (!metaData.AreaName.IsNullOrWhiteSpace())
{
//set the area to the plugin area
area = surfaceController.Metadata.AreaName;
area = metaData.AreaName;
}
return html.BeginUmbracoForm(action, surfaceController.Metadata.ControllerName, area, additionalRouteVals, htmlAttributes);
return html.BeginUmbracoForm(action, metaData.ControllerName, area, additionalRouteVals, htmlAttributes);
}
/// <summary>

View File

@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Web.Mvc
@@ -15,6 +17,7 @@ namespace Umbraco.Web.Mvc
/// <summary>
/// Gets the surface controllers
/// </summary>
[Obsolete("This property should not be used in code, controllers are to be instantiated via MVC. To get a list of SurfaceController types use the RegisteredSurfaceControllers property.")]
public IEnumerable<SurfaceController> SurfaceControllers
{
get { return Values; }
@@ -27,5 +30,6 @@ namespace Umbraco.Web.Mvc
{
get { return InstanceTypes; }
}
}
}