Search Results for

    Show / Hide Table of Contents
    View Source

    Class Template

    Represents a Template file.

    Inheritance
    object
    BeingDirtyBase
    EntityBase
    File
    Namespace: Umbraco.Cms.Core.Models
    Assembly: Umbraco.Core.dll
    Syntax
    [DataContract(IsReference = true)]
    public class Template : File, ITemplate, IFile, IEntity, IDeepCloneable, IRememberBeingDirty, ICanBeDirty

    Constructors

    View Source

    Template(IShortStringHelper, string?, string?)

    Initializes a new instance of the Template class.

    Declaration
    public Template(IShortStringHelper shortStringHelper, string? name, string? alias)
    Parameters
    Type Name Description
    IShortStringHelper shortStringHelper

    The short string helper for alias cleaning.

    string name

    The name of the template.

    string alias

    The alias of the template.

    View Source

    Template(IShortStringHelper, string?, string?, Func<File, string?>?)

    Initializes a new instance of the Template class.

    Declaration
    public Template(IShortStringHelper shortStringHelper, string? name, string? alias, Func<File, string?>? getFileContent)
    Parameters
    Type Name Description
    IShortStringHelper shortStringHelper

    The short string helper for alias cleaning.

    string name

    The name of the template.

    string alias

    The alias of the template.

    Func<File, string> getFileContent

    A function to retrieve the file content lazily.

    Properties

    View Source

    Alias

    Gets or sets the alias of the template.

    Declaration
    [DataMember]
    public string Alias { get; set; }
    Property Value
    Type Description
    string
    Remarks

    The alias is automatically cleaned using the underscore alias format.

    View Source

    IsLayoutTemplate

    Returns true if the template is used as a layout for other templates (i.e. it has 'children')

    Declaration
    public bool IsLayoutTemplate { get; set; }
    Property Value
    Type Description
    bool
    View Source

    IsMasterTemplate

    Returns true if the template is used as a layout for other templates (i.e. it has 'children')

    Declaration
    [Obsolete("Use IsLayoutTemplate instead. Scheduled for removal in Umbraco 20.")]
    public bool IsMasterTemplate { get; set; }
    Property Value
    Type Description
    bool
    View Source

    LayoutTemplateAlias

    Gets or sets the alias of the layout (parent) template.

    Declaration
    public string? LayoutTemplateAlias { get; set; }
    Property Value
    Type Description
    string

    The alias of the layout template, or null if this template has no layout.

    View Source

    LayoutTemplateId

    Gets or sets the layout template identifier as a lazy-loaded value.

    Declaration
    [DataMember]
    public Lazy<int>? LayoutTemplateId { get; set; }
    Property Value
    Type Description
    Lazy<int>

    A System.Lazy<T> containing the layout template's ID, or -1 if there is no layout template.

    View Source

    MasterTemplateAlias

    Gets or sets the alias of the layout (parent) template.

    Declaration
    [Obsolete("Use LayoutTemplateAlias instead. Scheduled for removal in Umbraco 20.")]
    public string? MasterTemplateAlias { get; set; }
    Property Value
    Type Description
    string

    The alias of the layout template, or null if this template has no layout.

    View Source

    MasterTemplateId

    Gets or sets the layout template identifier as a lazy-loaded value.

    Declaration
    [Obsolete("Use LayoutTemplateId instead. Scheduled for removal in Umbraco 20.")]
    public Lazy<int>? MasterTemplateId { get; set; }
    Property Value
    Type Description
    Lazy<int>

    A System.Lazy<T> containing the layout template's ID, or -1 if there is no layout template.

    View Source

    Name

    Gets or sets the name of the template.

    Declaration
    [DataMember]
    public string? Name { get; set; }
    Property Value
    Type Description
    string

    Methods

    View Source

    DeepCloneNameAndAlias(File)

    Overrides the base implementation to prevent File from cloning name and alias.

    Declaration
    protected override void DeepCloneNameAndAlias(File clone)
    Parameters
    Type Name Description
    File clone

    The cloned file instance.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX