November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
1. This is quite easy. Just have a look at my blog post on how to hide the Category property: https://www.gulla.net/hiding-episervers-category-property/ and combine that with my blogpost on how to move the Shortcut property: https://www.gulla.net/move-property-to-non-existing-tab/ and add a check for the page type, and you are good to go!
Something like this, to hide the Shortcut property for all instances of ArticlePage.
using System;
using System.Collections.Generic;
using EPiServer.Core;
using EPiServer.Shell.ObjectEditing;
using EPiServer.Shell.ObjectEditing.EditorDescriptors;
using TinyMCE.Models.Pages;
namespace Alloy.Business.EditorDescriptors
{
[EditorDescriptorRegistration(TargetType = typeof(ContentData))]
public class HideShortcutEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
if (metadata.Model is ArticlePage)
{
foreach (var modelMetadata in metadata.Properties)
{
var property = (ExtendedMetadata) modelMetadata;
if (property.PropertyName == "iversionable_shortcut")
{
property.ShowForEdit = false;
}
}
}
}
}
}
2. This could need some more investigation. The dojo widget used for displaying the Shortcut settings is epi-cms/contentediting/editors/ShortcutEditor. You could maybe create your own version of that?
Or maybe, even better, override the selection factory used for providing values for the dropdown. The type you are looking for is EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors.SelectionFactories.PageShortcutTypeSelectionFactory and it looks like this:
using EPiServer.Core;
using EPiServer.Framework.Localization;
using EPiServer.Shell.ObjectEditing;
using System;
namespace EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors.SelectionFactories
{
[SelectionFactoryRegistration]
public class PageShortcutTypeSelectionFactory : EnumSelectionFactory
{
public PageShortcutTypeSelectionFactory()
: this(LocalizationService.Current)
{
}
public PageShortcutTypeSelectionFactory(LocalizationService localizationService)
: base(localizationService)
{
}
protected override string GetStringForEnumValue(int value)
{
return this.LocalizationService.GetString("/episerver/cms/widget/shortcutblockeditor/shortcuttype" + (object) value);
}
protected override Type EnumType
{
get
{
return typeof (PageShortcutType);
}
}
}
}
Hey Tomas thanks for your assistance on this, it's much appreciated :)
The first option for hiding the Shortcut editor works perfectly.
Unfortunately, when I tried your second item (suggestion of overriding the selection factory in order to filter out the shortcut types) it doesn't seem to be working as expected. I am finding that when debugging, the class constructor:
PageShortcutTypeSelectionFactory(LocalizationService localizationService) : base(localizationService) { }
Is the only thing being hit in the overriden version that you gave as an example, so i'm not sure how to intercept the values returned to filter them out, unless i'm missing something here?
Greetings,
We have some specific requirements and I have been trying to figure out how to do either within EPiServer and was wondering if anyone could shed some light or offer assistance on the following 2 cases below.
Thanks