Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentRepositoryExtensions

    Extension methods used to manipulate content variations by the document repository

    Inheritance
    object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class ContentRepositoryExtensions

    Methods

    View Source

    AdjustDates(IContent, DateTime, bool)

    Used to synchronize all culture dates to the same date if they've been modified

    Declaration
    public static void AdjustDates(this IContent content, DateTime date, bool publishing)
    Parameters
    Type Name Description
    IContent content
    DateTime date
    bool publishing
    Remarks

    This is so that in an operation where (for example) 2 languages are updates like french and english, it is possible that these dates assigned to them differ by a couple of Ticks, but we need to ensure they are persisted at the exact same time.

    View Source

    ClearPublishInfo(IContent, string?)

    Returns false if the culture is already unpublished

    Declaration
    public static bool ClearPublishInfo(this IContent content, string? culture)
    Parameters
    Type Name Description
    IContent content
    string culture
    Returns
    Type Description
    bool
    View Source

    ClearPublishInfos(IContent)

    Clears all publish culture information from the content item.

    Declaration
    public static void ClearPublishInfos(this IContent content)
    Parameters
    Type Name Description
    IContent content

    The content item to clear publish information from.

    View Source

    CopyFrom(IContent, IContent, string?)

    Copies values from another document.

    Declaration
    public static void CopyFrom(this IContent content, IContent other, string? culture = "*")
    Parameters
    Type Name Description
    IContent content
    IContent other
    string culture
    View Source

    GetCulturesUnpublishing(IContent)

    Gets the cultures that have been flagged for unpublishing.

    Declaration
    public static IReadOnlyList<string>? GetCulturesUnpublishing(this IContent content)
    Parameters
    Type Name Description
    IContent content
    Returns
    Type Description
    IReadOnlyList<string>
    Remarks

    Gets cultures for which content.UnpublishCulture() has been invoked.

    View Source

    PublishCulture(IContent, CultureImpact?, DateTime, PropertyEditorCollection)

    Sets the publishing values for names and properties.

    Declaration
    public static bool PublishCulture(this IContent content, CultureImpact? impact, DateTime publishTime, PropertyEditorCollection propertyEditorCollection)
    Parameters
    Type Name Description
    IContent content
    CultureImpact impact
    DateTime publishTime
    PropertyEditorCollection propertyEditorCollection
    Returns
    Type Description
    bool

    A value indicating whether it was possible to publish the names and values for the specified culture(s). The method may fail if required names are not set, but it does NOT validate property data

    View Source

    SetCultureEdited(IContent, IEnumerable<string?>?)

    Sets the cultures that have been edited on the content item.

    Declaration
    public static void SetCultureEdited(this IContent content, IEnumerable<string?>? cultures)
    Parameters
    Type Name Description
    IContent content

    The content item to update.

    IEnumerable<string> cultures

    The collection of culture codes that have been edited, or null to clear.

    View Source

    SetCultureInfo(IContentBase, string?, string?, DateTime)

    Sets the culture information for a specific culture on the content item.

    Declaration
    public static void SetCultureInfo(this IContentBase content, string? culture, string? name, DateTime date)
    Parameters
    Type Name Description
    IContentBase content

    The content item to update.

    string culture

    The culture code (e.g., "en-US").

    string name

    The name of the content in the specified culture.

    DateTime date

    The date to associate with this culture information.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when name or culture is null.

    ArgumentException

    Thrown when name or culture is empty or whitespace.

    View Source

    SetPublishInfo(IContent, string?, string?, DateTime)

    Sets the publish information for a specific culture on the content item.

    Declaration
    public static void SetPublishInfo(this IContent content, string? culture, string? name, DateTime date)
    Parameters
    Type Name Description
    IContent content

    The content item to update.

    string culture

    The culture code (e.g., "en-US").

    string name

    The published name of the content in the specified culture.

    DateTime date

    The publish date to associate with this culture.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when name or culture is null.

    ArgumentException

    Thrown when name or culture is empty or whitespace.

    View Source

    TouchCulture(IContentBase, string?)

    Updates a culture date, if the culture exists.

    Declaration
    public static void TouchCulture(this IContentBase content, string? culture)
    Parameters
    Type Name Description
    IContentBase content
    string culture
    View Source

    UnpublishCulture(IContent, string?)

    Returns false if the culture is already unpublished

    Declaration
    public static bool UnpublishCulture(this IContent content, string? culture = "*")
    Parameters
    Type Name Description
    IContent content
    string culture
    Returns
    Type Description
    bool
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX