本文整理汇总了C#中ItemDefinition类的典型用法代码示例。如果您正苦于以下问题:C# ItemDefinition类的具体用法?C# ItemDefinition怎么用?C# ItemDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemDefinition类属于命名空间,在下文中一共展示了ItemDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddEditableText
private void AddEditableText(ItemDefinition definition, string title, string name, int sortOrder, int maxLength)
{
EditableTextBoxAttribute titleEditor = new EditableTextBoxAttribute(title, sortOrder, maxLength);
titleEditor.Name = name;
titleEditor.ContainerName = "seo";
definition.Add(titleEditor);
}
示例2: Refine
public override void Refine(ItemDefinition currentDefinition)
{
if (InstallerVisibility != InstallerHint.Default)
currentDefinition.Installer = InstallerVisibility;
base.Refine(currentDefinition);
}
示例3: PrefetchData
// Methods
public PrefetchData(ItemDefinition itemDefinition, ID parentId)
{
Assert.ArgumentNotNull(itemDefinition, "itemDefinition");
Assert.ArgumentNotNull(parentId, "parentId");
this._itemDefinition = itemDefinition;
this._parentId = parentId;
}
示例4: Refine
public void Refine(ItemDefinition currentDefinition, IList<ItemDefinition> allDefinitions)
{
if (currentDefinition.ItemType.IsAssignableFrom(typeof (BlogContainer)))
{
currentDefinition.AllowedChildFilters.Add(this);
}
}
示例5: DraggableToolbar
public DraggableToolbar(ContentItem item, ItemDefinition definition)
{
if (definition == null) throw new ArgumentNullException("definition");
this.currentItem = item;
this.definition = definition;
}
示例6: IsUnfiltered
public bool IsUnfiltered(ItemDefinition d)
{
if(RemovedTypes == null)
return true;
return !RemovedTypes.Any(rt => rt.IsAssignableFrom(d.ItemType));
}
示例7: AddDefinedEditors
public override IDictionary<string, System.Web.UI.Control> AddDefinedEditors(ItemDefinition definition, N2.ContentItem item, System.Web.UI.Control container, System.Security.Principal.IPrincipal user, Type containerTypeFilter, IEnumerable<string> editableNameFilter)
{
ItemDefinition cloned = null;
// add a "wrap in container" checkbox to all parts that are within zones that are not wrapped in a container (BeforeMain, AfterMain).
if (!definition.IsPage)
{
if (!(Defaults.IsContainerWrappable(item.ZoneName) ||
Defaults.IsContainerWrappable(System.Web.HttpContext.Current.Request["zoneName"])))
{
cloned = definition.Clone();
var isWrappable = cloned.Editables.FirstOrDefault(x => x.Name == "UseContainer");
if (isWrappable != null)
{
cloned.Editables.Remove(isWrappable);
}
}
}
if (item is IItemAdapter)
{
var result = (item as IItemAdapter).AddDefinedEditors(cloned ?? definition, container, user, containerTypeFilter, editableNameFilter);
if (result != null)
return result;
}
return base.AddDefinedEditors(cloned ?? definition, item, container, user, containerTypeFilter, editableNameFilter);
}
示例8: ChangeTemplateThrowsIfNoDbItemFound
public void ChangeTemplateThrowsIfNoDbItemFound([Greedy]FakeDataProvider sut, ItemDefinition def, TemplateChangeList changes)
{
Action action = () => sut.ChangeTemplate(def, changes, null);
action.ShouldThrow<InvalidOperationException>()
.WithMessage("Unable to change item template. The item '{0}' is not found.".FormatWith(def.ID));
}
示例9: AddChildIDsForContactFacetItem
protected virtual void AddChildIDsForContactFacetItem(IDList ids, ItemDefinition itemDefinition, CallContext context)
{
var facetName = IDTableHelper.GetFacetName(itemDefinition.ID);
var contractType = ContactFacetHelper.GetContractTypeForFacet(facetName);
foreach (string memberName in FacetReflectionUtil.NonFacetMemberNames(contractType))
{
var id = IDTableHelper.GenerateIdForFacetMember(memberName, itemDefinition.ID,
Sitecore.Strategy.Contacts.DataProviders.TemplateIDs.ContactFacetMemberTemplate);
ids.Add(id);
}
foreach (string memberName in FacetReflectionUtil.FacetMemberNames(contractType))
{
foreach (
string subMemberName in
FacetReflectionUtil.NonFacetMemberNames(contractType.GetProperty(memberName).PropertyType))
{
string key = $"{memberName}{NestedFacets.Delimeter}{subMemberName}";
var id = IDTableHelper.GenerateIdForFacetMember(key, itemDefinition.ID,
Sitecore.Strategy.Contacts.DataProviders.TemplateIDs.ContactFacetMemberTemplate);
ids.Add(id);
}
}
}
示例10: GetTemplates
public IEnumerable<TemplateDefinition> GetTemplates(ItemDefinition definition)
{
return Definitions.GetTemplates(definition.ItemType)
.AllowedBelow(Definitions.GetDefinition(Selection.SelectedItem), Selection.SelectedItem, Engine.Definitions)
.Where(t => t.Definition.IsAllowed(ZoneName, User))
.OrderBy(t => (t.Definition.TemplateKey ?? "Index") == "Index" ? 0 : 1)
.ThenBy(t => t.Definition.SortOrder);
}
示例11: AllowedBelow
public static IEnumerable<TemplateDefinition> AllowedBelow(this IEnumerable<TemplateDefinition> allTemplates, ItemDefinition parentDefinition, ContentItem parentItem, IDefinitionManager definitions)
{
foreach (var template in allTemplates)
{
if (IsAllowed(template.Definition, parentItem, parentDefinition, definitions))
yield return template;
}
}
示例12: Refine
/// <summary>Changes allowed parents on the item definition.</summary>
/// <param name="currentDefinition">The definition to alter.</param>
/// <param name="allDefinitions">All definitions.</param>
public override void Refine(ItemDefinition currentDefinition, IList<ItemDefinition> allDefinitions)
{
foreach (ItemDefinition definition in allDefinitions)
{
if (IsAssignable(definition.ItemType))
definition.AddAllowedChild(currentDefinition);
}
}
示例13: GetChildIDs
public override IDList GetChildIDs(ItemDefinition itemDefinition, CallContext context)
{
if (itemDefinition != null && itemDefinition.ID == JoinParentId)
{
Log.Info(string.Format("GetChildIDs called with itemDefinition id = {0}, name = {1} (BasicDataProvider)", itemDefinition.ID, itemDefinition.Name), this);
}
return null;
}
示例14: Refine
public override void Refine(ItemDefinition currentDefinition, IList<ItemDefinition> allDefinitions)
{
if (AffectedType != null && !AffectedType.IsAssignableFrom(currentDefinition.ItemType))
return;
var containable = currentDefinition.GetNamed(Name);
currentDefinition.RemoveRange(containable);
}
示例15: SetUp
public void SetUp()
{
parentDefinition = new ItemDefinition(typeof(DefinitionControllingParent)) { TemplateKey = "List" };
childDefinition = new ItemDefinition(typeof(DefinitionOppressedChild)) { TemplateKey = "Wide" };
definitions = MockRepository.GenerateStub<IDefinitionManager>();
definitions.Expect(d => d.GetDefinitions()).Return(new[] { parentDefinition, childDefinition }).Repeat.Any();
}