<commit_before>using Orchard.DisplayManagement.Descriptors;
using Orchard.Environment.Extensions;

namespace DQ.Scheduling {
    [OrchardFeature("DQ.CalendarWidget")]
    public class Shapes : IShapeTableProvider {

        public void Discover(ShapeTableBuilder builder) {
            builder.Describe("Parts_CalendarWidget")
                .OnDisplaying(displaying => {
                    string plugin = displaying.Shape.Plugin;
                    displaying.ShapeMetadata.Alternates.Add("Parts_CalendarWidget__" + plugin);
                });
        }
    }
}<commit_msg>Bugfix only active provider shapes<commit_after>using System.Collections.Generic;
using System.Linq;
using DQ.Scheduling.CalendarProviders;
using Orchard.DisplayManagement.Descriptors;
using Orchard.Environment.Extensions;

namespace DQ.Scheduling {
    [OrchardFeature("DQ.CalendarWidget")]
    public class Shapes : IShapeTableProvider {

        private readonly IEnumerable<ICalendarProvider> _providers;
        public Shapes(IEnumerable<ICalendarProvider> providers) {
            _providers = providers;
        }

        public void Discover(ShapeTableBuilder builder) {
            builder.Describe("Parts_CalendarWidget")
                .OnDisplaying(displaying => {
                    string plugin = displaying.Shape.Plugin;
                    var provider = _providers.FirstOrDefault(p => p.Name == plugin);

                    // Only if the provider is enabled
                    if (provider != null) {
                        displaying.ShapeMetadata.Alternates.Add("Parts_CalendarWidget__" + plugin);
                    }
                });
        }
    }
}
{'fraction_non_alphanumeric': 0.08478653036680697, 'fraction_numerical': 0.0, 'mean_word_length': 2.3616161616161615, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '278568', 'n_tokens_mistral': 428, 'n_tokens_neox': 394, 'n_words': 77}