Ejemplo n.º 1
0
    // gets a published content as a previewing draft, if preview is true
    // this is for published content when previewing
    private static IPublishedContent?GetPublishedContentAsDraft(IPublishedContent?content /*, bool preview*/)
    {
        if (content == null /*|| preview == false*/)
        {
            return(null); // content;
        }

        // an object in the cache is either an IPublishedContentOrMedia,
        // or a model inheriting from PublishedContentExtended - in which
        // case we need to unwrap to get to the original IPublishedContentOrMedia.
        var inner = PublishedContent.UnwrapIPublishedContent(content);

        return(inner.AsDraft());
    }
Ejemplo n.º 2
0
    public NavigableContent(IPublishedContent content)
    {
        InnerContent = content;
        _content     = PublishedContent.UnwrapIPublishedContent(InnerContent);

        var i = 0;

        _builtInValues = new[]
        {
            XmlString(i++, _content.Name), XmlString(i++, _content.ParentId), XmlString(i++, _content.CreateDate),
            XmlString(i++, _content.UpdateDate), XmlString(i++, true), // isDoc
            XmlString(i++, _content.SortOrder), XmlString(i++, _content.Level), XmlString(i++, _content.TemplateId),
            XmlString(i++, _content.WriterId), XmlString(i++, _content.CreatorId), XmlString(i++, _content.UrlSegment),
            XmlString(i, _content.IsDraft()),
        };
    }