/// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            var editControl = new RockDropDownList {
                ID = id
            };

            editControl.Items.Add(new ListItem());

            var contentChannels = new ContentChannelService(new RockContext()).Queryable()
                                  .Where(a => a.ContentChannelType.ShowInChannelList == true)
                                  .OrderBy(d => d.Name)
                                  .Select(a => new
            {
                a.Guid,
                a.Name,
            }).ToList();

            if (contentChannels.Any())
            {
                foreach (var contentChannel in contentChannels)
                {
                    editControl.Items.Add(new ListItem(contentChannel.Name, contentChannel.Guid.ToString()));
                }

                return(editControl);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            var editControl = new RockDropDownList {
                ID = id
            };

            editControl.Items.Add(new ListItem());

            var contentChannels = new ContentChannelService(new RockContext()).Queryable().OrderBy(d => d.Name);

            if (contentChannels.Any())
            {
                foreach (var contentChannel in contentChannels)
                {
                    editControl.Items.Add(new ListItem(contentChannel.Name, contentChannel.Guid.ToString().ToUpper()));
                }

                return(editControl);
            }

            return(null);
        }