Beispiel #1
0
        public void Initialize(Framework.Initialization.InitializationEngine context)
        {
            if (_initialized || PageReference.IsNullOrEmpty(GlobalNewsContainer) || context.HostType != HostType.WebApplication)
            {
                return;
            }

            var providerManager = ServiceLocator.Current.GetInstance <IContentProviderManager>();

            var startPages = DataFactory.Instance.GetChildren(PageReference.RootPage).OfType <StartPage>();

            // Attach content provider to each site's global news container
            foreach (var startPage in startPages.Where(startPage => !PageReference.IsNullOrEmpty(startPage.GlobalNewsPageLink)))
            {
                try
                {
                    _logger.DebugFormat("Attaching global news content provider to page {0} [{1}], global news will be retrieved from page {2} [{3}]",
                                        startPage.GlobalNewsPageLink.GetPage().Name,
                                        startPage.GlobalNewsPageLink.ID,
                                        GlobalNewsContainer.GetPage().PageName,
                                        GlobalNewsContainer.ID);

                    var provider = new ClonedContentProvider(GlobalNewsContainer, startPage.GlobalNewsPageLink, startPage.Category);

                    providerManager.ProviderMap.AddProvider(provider);
                }
                catch (Exception ex)
                {
                    _logger.ErrorFormat("Unable to create global news content provider for start page with ID {0}: {1}", startPage.PageLink.ID, ex.Message);
                }
            }

            _initialized = true;
        }
Beispiel #2
0
 public void Initialize(Framework.Initialization.InitializationEngine context)
 {
     if (String.IsNullOrEmpty(_cdnUrl.Value))
     {
         return;
     }
     ContentRoute.CreatedVirtualPath += ContentRoute_CreatedVirtualPath;
 }
 public void Initialize(Framework.Initialization.InitializationEngine context)
 {
     if (String.IsNullOrEmpty(_cdnUrl.Value))
     {
         return;
     }
     context.Locate.Advanced.GetInstance <IContentRouteEvents>().CreatedVirtualPath += ContentRoute_CreatedVirtualPath;
 }
Beispiel #4
0
 public void Initialize(Framework.Initialization.InitializationEngine context)
 {
     if (context.HostType == HostType.WebApplication)
     {
         // Use our own control to render content areas
         PropertyControlClassFactory.Instance.RegisterClass(
             typeof(PropertyContentArea),             // We want to use our own control whenever a PropertyContentArea property is rendered
             typeof(SitePropertyContentAreaControl)); // Use our own control derived from PropertyContentAreaControl, customized for the Bootstrap HTML framework
     }
 }
Beispiel #5
0
        public void Initialize(Framework.Initialization.InitializationEngine context)
        {
            // Create provider root if not exists
            var contentRepository = context.Locate.ContentRepository();
            var youTubeRoot       = contentRepository.GetBySegment(SiteDefinition.Current.RootPage, YouTubeSettings.ProviderName, LanguageSelector.AutoDetect(true));

            if (youTubeRoot == null)
            {
                youTubeRoot      = contentRepository.GetDefault <ContentFolder>(SiteDefinition.Current.RootPage);
                youTubeRoot.Name = YouTubeSettings.ProviderName;
                contentRepository.Save(youTubeRoot, SaveAction.Publish, AccessLevel.NoAccess);
            }

            // Register provider
            var contentProviderManager = context.Locate.Advanced.GetInstance <IContentProviderManager>();
            var configValues           = new NameValueCollection {
                { ContentProviderElement.EntryPointString, youTubeRoot.ContentLink.ToString() }
            };
            var provider = context.Locate.Advanced.GetInstance <YouTubeProvider>();

            provider.Initialize(YouTubeSettings.ProviderKey, configValues);
            contentProviderManager.ProviderMap.AddProvider(provider);

            // Since we have our structure outside asset root we registera custom route for it
            // and remove the language segment
            RouteTable.Routes.MapContentRoute(
                name: "YouTubeMedia",
                url: "youtube/{node}/{partial}/{action}",
                defaults: new { action = "index" },
                contentRootResolver: (s) => youTubeRoot.ContentLink);

            // EPiServer UI needs the language segment
            RouteTable.Routes.MapContentRoute(
                name: "YouTubeMediaEdit",
                url: CmsHomePath + "youtube/{language}/{medianodeedit}/{partial}/{action}",
                defaults: new { action = "index" },
                contentRootResolver: (s) => youTubeRoot.ContentLink);
        }
Beispiel #6
0
 public void Uninitialize(Framework.Initialization.InitializationEngine context)
 {
 }