Esempio n. 1
0
        private void CheckContentProperties(IContent content, IList <Tag> tags)
        {
            var contentType = _contentTypeRepository.Load(content.ContentTypeID);

            foreach (var propertyDefinition in contentType.PropertyDefinitions)
            {
                if (!TagsHelper.IsTagProperty(propertyDefinition))
                {
                    continue;
                }

                var tagNames = GetTagNames(content, propertyDefinition);

                var allTags = tags;

                if (tagNames == null)
                {
                    RemoveFromAllTags(content.ContentGuid, allTags);
                    continue;
                }

                var addedTags = ParseTags(tagNames);

                // make sure the tags it has added has the ContentReference
                ValidateTags(allTags, content.ContentGuid, addedTags);

                // make sure there's no ContentReference to this ContentReference in the rest of the tags
                RemoveFromAllTags(content.ContentGuid, allTags);
            }
        }
Esempio n. 2
0
        private void CheckPageProperties(PageData page, IList <Tag> tags)
        {
            var pageType = _pageTypeRepository.Load(page.PageTypeID);

            foreach (var propertyDefinition in pageType.PropertyDefinitions)
            {
                if (!TagsHelper.IsTagProperty(propertyDefinition))
                {
                    continue;
                }

                var tagNames = page[propertyDefinition.Name] as string;

                IList <Tag> allTags = tags;

                if (tagNames == null)
                {
                    RemoveFromAllTags(page.PageGuid, allTags);
                    continue;
                }

                var addedTags = ParseTags(tagNames);

                // make sure the tags it has added has the pagereference
                ValidateTags(allTags, page.PageGuid, addedTags);

                // make sure there's no pagereference to this pagereference in the rest of the tags
                RemoveFromAllTags(page.PageGuid, allTags);
            }
        }