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); }
private EditableTextBoxAttribute AddEditableText(ItemDefinition definition, string title, string name, int sortOrder, int maxLength) { EditableTextBoxAttribute editor = new EditableTextBoxAttribute(title, sortOrder, maxLength); editor.Name = name; editor.ContainerName = Tabs.Details; definition.Add(editor); return editor; }
/// <summary> /// Adds an <see cref="EditableTextBoxAttribute"/> to the item definition. /// </summary> /// <param name="itemDefinition">Specifies the <see cref="ItemDefinition"/> the /// <see cref="EditableEnumAttribute"/> will be added to.</param> /// <param name="title">Specifies the value to use for /// <see cref="EditableEnumAttribute.Title"/>.</param> /// <param name="sortOrder">Specifies the value to use for /// <see cref="EditableEnumAttribute.SortOrder"/>.</param> /// <param name="maxLength">Specifies the value to use for /// <see cref="EditableEnumAttribute.MaxLength"/>.</param> /// <param name="containerName">Specifies the value to use for /// <see cref="EditableEnumAttribute.ContainerName"/>.</param> /// <param name="propertyKey">Specifies the value to use for /// <see cref="EditableEnumAttribute.Name"/>.</param> /// <param name="helpTitle">Specifies the value to use for /// <see cref="EditableEnumAttribute.HelpTitle"/>.</param> /// <param name="helpText">Specifies the value to use for /// <see cref="EditableEnumAttribute.HelpText"/>.</param> /// <returns>The <see cref="EditableTextBoxAttribute"/> added to the item definition.</returns> public static EditableTextBoxAttribute AddEditableTextBox(this ItemDefinition itemDefinition, string title, int sortOrder, int maxLength, string containerName, string propertyKey, string helpTitle = null, string helpText = null) { if (itemDefinition == null) throw new ArgumentNullException("itemDefinition", "itemDefinition is null."); if (String.IsNullOrEmpty(title)) throw new ArgumentException("title is null or empty.", "title"); if (String.IsNullOrEmpty(containerName)) throw new ArgumentException("containerName is null or empty.", "containerName"); if (String.IsNullOrEmpty(propertyKey)) throw new ArgumentException("propertyKey is null or empty.", "propertyKey"); if (maxLength <= 0) throw new ArgumentOutOfRangeException("maxLength"); EditableTextBoxAttribute result = new EditableTextBoxAttribute(title, sortOrder, maxLength) { ContainerName = containerName, Name = propertyKey, HelpTitle = helpTitle, HelpText = helpText }; itemDefinition.Add(result); Debug.WriteLine(string.Format("{0} property added to {1}", propertyKey, itemDefinition.Title)); return result; }