Exemplo n.º 1
0
    /// <inheritdoc />
    public override bool IsPublished(string?culture = null)
    {
        // whether we are the 'draft' or 'published' content, need to determine whether
        // there is a 'published' version for the specified culture (or at all, for
        // invariant content items)

        // if there is no 'published' published content, no culture can be published
        if (!_contentNode.HasPublished)
        {
            return(false);
        }

        // if there is a 'published' published content, and does not vary = published
        if (!ContentType.VariesByCulture())
        {
            return(true);
        }

        // handle context culture
        if (culture == null)
        {
            culture = VariationContextAccessor?.VariationContext?.Culture ?? string.Empty;
        }

        // there is a 'published' published content, and varies
        // = depends on the culture
        return(_contentNode.HasPublishedCulture(culture));
    }