mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Updated Page commands to create home page alias.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using Orchard.Autoroute.Services;
|
||||
using Orchard.Commands;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
@@ -21,6 +22,7 @@ namespace Orchard.Pages.Commands {
|
||||
private readonly IMenuService _menuService;
|
||||
private readonly INavigationManager _navigationManager;
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
private readonly IHomeAliasService _homeAliasService;
|
||||
|
||||
public PageCommands(
|
||||
IContentManager contentManager,
|
||||
@@ -28,12 +30,15 @@ namespace Orchard.Pages.Commands {
|
||||
IAuthenticationService authenticationService,
|
||||
ISiteService siteService,
|
||||
IMenuService menuService,
|
||||
INavigationManager navigationManager) {
|
||||
INavigationManager navigationManager,
|
||||
IHomeAliasService homeAliasService) {
|
||||
|
||||
_contentManager = contentManager;
|
||||
_membershipService = membershipService;
|
||||
_siteService = siteService;
|
||||
_menuService = menuService;
|
||||
_navigationManager = navigationManager;
|
||||
_homeAliasService = homeAliasService;
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
@@ -94,15 +99,9 @@ namespace Orchard.Pages.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
//// (PH:Autoroute) Hackish way to leave Slug and Homepage switches intact without requiring a dependency on Autoroute. This may throw an Exception with
|
||||
//// no AutoroutePart. But it means that normal setup recipes will still be able to give you a homepage without issue.
|
||||
//if (Homepage || !String.IsNullOrWhiteSpace(Slug)) {
|
||||
// dynamic dpage = page;
|
||||
// if (dpage.AutoroutePart != null) {
|
||||
// dpage.AutoroutePart.UseCustomPattern = true;
|
||||
// dpage.AutoroutePart.CustomPattern = Homepage ? "/" : Slug;
|
||||
// }
|
||||
//}
|
||||
if (Homepage) {
|
||||
_homeAliasService.PublishHomeAlias(page);
|
||||
}
|
||||
|
||||
var layout = default(string);
|
||||
if (UseWelcomeText) {
|
||||
|
||||
@@ -6,5 +6,5 @@ Version: 1.9.1
|
||||
OrchardVersion: 1.9
|
||||
Description: Introduces a preconfigured page content type.
|
||||
FeatureDescription: A basic page content type.
|
||||
Dependencies: Contents, Orchard.ContentPicker
|
||||
Dependencies: Contents, Orchard.ContentPicker, Orchard.Autoroute
|
||||
Category: Content
|
||||
|
||||
@@ -78,6 +78,10 @@
|
||||
<Name>Orchard.Core</Name>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
|
||||
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
|
||||
<Name>Orchard.Autoroute</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.ContentPicker\Orchard.ContentPicker.csproj">
|
||||
<Project>{f301ef7d-f19c-4d83-aa94-cb64f29c037d}</Project>
|
||||
<Name>Orchard.ContentPicker</Name>
|
||||
|
||||
Reference in New Issue
Block a user