ContentReferenceList - Browsing for content issue

A.D
A.D
Vote:
 

Howdy,

I've started using the ContentReferenceList property (see http://blog.huilaaja.net/2015/08/19/contentreferencelist-property-in-episerver-cms-8-6-0/).

Looks really good. Just one minor issue: we have a multisite setup. Each site uses 'Site-specific assets'.

If I go to a ContentReferenceList property, and click on the 'Browse' link, the dialog only shows the following:

Root

  - Content Assets

  - For All Sites

For This Page

I.E., it doesn't show the 'For This Site' folder. However, I can easily work around this issue by using the assets pane instead. But of course the assets pane isn't filtered by content type like the dialog.

Anyone else have the same issue?

Thanks,

#141943
Nov 25, 2015 0:13
Vote:
 

Hi,

Maybye you could reuse this snippet. It allows you to change the root for the ContentReferences property editor dialog window.

    public class ProductPage : StandardPage
    {
...
        [Display(Name = "Content References list", GroupName = SystemTabNames.Content, Order = 1000)]
        [CustomContentReferencesRoot]
        public virtual IList<ContentReference> TestContentReferences { get; set; }
...		
    }

    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class CustomContentReferencesRootAttribute : Attribute, IMetadataAware
    {
        public void OnMetadataCreated(ModelMetadata metadata)
        {
            ExtendedMetadata extendedMetadata = metadata as ExtendedMetadata;
            if (extendedMetadata == null)
                return;
            extendedMetadata.EditorConfiguration["roots"] = new[] { ContentReference.StartPage.ID, 44, 45 }; // set roots id here based on custom logic
        }
    }
#141973
Nov 25, 2015 12:24
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.