Пример #1
0
        /// <summary>
        /// Loads the custom settings tabs.
        /// </summary>
        protected void LoadCustomSettingsTabs()
        {
            int blockId = PageParameter("BlockId").AsInteger();
            var block   = BlockCache.Get(blockId);

            CustomSettingsProviders = new Dictionary <RockCustomSettingsProvider, Control>();

            var providers = RockCustomSettingsProvider.GetProvidersForType(block.BlockType.GetCompiledType()).Reverse();

            foreach (var provider in providers)
            {
                var control = provider.GetCustomSettingsControl(block, phCustomSettings);
                control.Visible = false;

                if (provider.CustomSettingsTitle == "Basic Settings")
                {
                    phCustomBasicSettings.Controls.Add(control);
                }
                else if (provider.CustomSettingsTitle == "Advanced Settings")
                {
                    phCustomAdvancedSettings.Controls.Add(control);
                }
                else
                {
                    phCustomSettings.Controls.Add(control);
                }

                CustomSettingsProviders.Add(provider, control);
            }
        }
        /// <summary>
        /// Loads the custom settings tabs.
        /// </summary>
        protected void LoadCustomSettingsTabs()
        {
            int blockId = PageParameter("BlockId").AsInteger();
            var block   = BlockCache.Get(blockId);

            CustomSettingsProviders = new Dictionary <RockCustomSettingsProvider, Control>();

            var providers = RockCustomSettingsProvider.GetProvidersForType(block.BlockType.GetCompiledType()).Reverse();

            foreach (var provider in providers)
            {
                // Place the custom controls in a naming container to avoid
                // ID collisions.
                var controlContainer = new CompositePlaceHolder();

                if (provider.CustomSettingsTitle == "Basic Settings")
                {
                    phCustomBasicSettings.Controls.Add(controlContainer);
                }
                else if (provider.CustomSettingsTitle == "Advanced Settings")
                {
                    phCustomAdvancedSettings.Controls.Add(controlContainer);
                }
                else
                {
                    phCustomSettings.Controls.Add(controlContainer);
                }

                var control = provider.GetCustomSettingsControl(block, phCustomSettings);
                control.Visible = false;
                controlContainer.Controls.Add(control);

                CustomSettingsProviders.Add(provider, control);
            }
        }