PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Handlers/S3StorageProviderSettingsPartHandler.cs

#
C# | 27 lines | 24 code | 3 blank | 0 comment | 2 complexity | e3c6a9fb3437cf5a5fe0a428089ecb9e MD5 | raw file
 1using JetBrains.Annotations;
 2using Werul.S3StorageProvider.Models;
 3using Orchard.ContentManagement;
 4using Orchard.Data;
 5using Orchard.ContentManagement.Handlers;
 6using Orchard.Localization;
 7
 8namespace Werul.S3StorageProvider.Handlers {
 9    [UsedImplicitly]
10    public class S3StorageProviderSettingsPartHandler : ContentHandler {
11        public S3StorageProviderSettingsPartHandler(IRepository<S3StorageProviderSettingsRecord> repository)
12        {
13            T = NullLocalizer.Instance;
14            Filters.Add(new ActivatingFilter<S3StorageProviderSettingsPart>("Site"));
15            Filters.Add(StorageFilter.For(repository));
16        }
17
18        public Localizer T { get; set; }
19
20        protected override void GetItemMetadata(GetContentItemMetadataContext context) {
21            if (context.ContentItem.ContentType != "Site")
22                return;
23            base.GetItemMetadata(context);
24            context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Amazon S3")));
25        }
26    }
27}