Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IViewHelper

    Provides helper methods for working with template view files.

    Namespace: Umbraco.Cms.Core.IO
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IViewHelper

    Methods

    View Source

    CreateView(ITemplate, bool)

    Creates a view file for the specified template.

    Declaration
    string CreateView(ITemplate t, bool overWrite = false)
    Parameters
    Type Name Description
    ITemplate t

    The template to create a view for.

    bool overWrite

    Whether to overwrite an existing view file.

    Returns
    Type Description
    string

    The contents of the view file.

    View Source

    GetFileContents(ITemplate)

    Gets the file contents of the specified template's view file.

    Declaration
    string GetFileContents(ITemplate t)
    Parameters
    Type Name Description
    ITemplate t

    The template to get contents for.

    Returns
    Type Description
    string

    The contents of the view file, or an empty string if the file does not exist.

    View Source

    UpdateViewFile(ITemplate, string?)

    Updates the view file for the specified template.

    Declaration
    string? UpdateViewFile(ITemplate t, string? currentAlias = null)
    Parameters
    Type Name Description
    ITemplate t

    The template to update the view for.

    string currentAlias

    The current alias of the template, used to rename the file if the alias has changed.

    Returns
    Type Description
    string

    The content of the updated view file.

    View Source

    ViewExists(ITemplate)

    Determines whether a view file exists for the specified template.

    Declaration
    bool ViewExists(ITemplate t)
    Parameters
    Type Name Description
    ITemplate t

    The template to check.

    Returns
    Type Description
    bool

    true if the view file exists; otherwise, false.

    View Source

    ViewPath(string)

    Gets the relative path to a view file based on the template alias.

    Declaration
    string ViewPath(string alias)
    Parameters
    Type Name Description
    string alias

    The template alias.

    Returns
    Type Description
    string

    The relative path to the view file.

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