umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.54k stars 2.71k forks source link

[DropDownList] - Need Default value selector option in dropdown list data type #17624

Open XeroDays opened 4 days ago

XeroDays commented 4 days ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.4.1

Bug summary

In this Datatype- this is really improtant in many cases where we have to assign a default value to the drop down, i have tried different code such as overriding PropertyValueConverterBase class but that is also not working.

image

image

Code on the controller which i have used to modify the data type,

using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PropertyEditors;

public class NavBarDropdownPropertyValueConverter : PropertyValueConverterBase
{
    public override bool IsConverter(IPublishedPropertyType propertyType)
        => propertyType.EditorAlias.Equals("Umbraco.DropDown.Flexible");

    public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview)
    {
        if (source == null || string.IsNullOrEmpty(source.ToString()))
        {
            return "UnBranded Menu";  
        }

        return base.ConvertSourceToIntermediate(owner, propertyType, source, preview);
    }
}

Specifics

image

Steps to reproduce

  1. Login to Umbraco CMS Backoffice.
  2. Click on Settings tab.
  3. Then click on DAta type
  4. Create new Data type
  5. Select DropDownList from the Selector.
  6. Add items in teh Dropdown List items
  7. Save it
  8. Use the Datatype in any page
  9. You will see defualt its taking as index 0;

Expected result / actual result

Here we should have an option for seelct a default value .

github-actions[bot] commented 4 days ago

Hi there @XeroDays!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face: