Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Consent field is missing show label feature #810

Closed
bjarnef opened this issue Jul 12, 2022 · 5 comments
Closed

Data Consent field is missing show label feature #810

bjarnef opened this issue Jul 12, 2022 · 5 comments

Comments

@bjarnef
Copy link

bjarnef commented Jul 12, 2022

The Data Consent field is missing the "Show Label" feature as other fields has.

image

E.g. Short Answer field type has this Show Label (enabled by default).

image

Umbraco v10.0.1
Umbraco Forms v10.0.3

@bjarnef bjarnef changed the title Data Consent field it missing show label feature Data Consent field is missing show label feature Jul 12, 2022
@bjarnef
Copy link
Author

bjarnef commented Jul 12, 2022

I also think it would be useful in custom field type inheriting Umbraco.Forms.Core.FieldType by default included/show this property.

@AndyButland
Copy link

I've added this now, will be in the upcoming minor release. I think we probably need to add it to all that need it as there's some that you wouldn't want to give the editor the option to show the label (e.g. recaptcha).

@bjarnef
Copy link
Author

bjarnef commented Jul 13, 2022

@AndyButland how do we add the "Show Label" to custom field types?
For example prevalue source is shown when setting SupportsPreValues = true.

Ideally I think fields inheriting from Umbraco.Forms.Core.FieldType should by default has "Show Label" property and set to true, but the option to hide it or set the value to false.

@AndyButland
Copy link

AndyButland commented Jul 13, 2022

Like this:

/// <summary>
/// Gets or sets a value indicating whether the field label should be shown.
/// PreValues are a single element, a boolean indicating whether the default for the the checkbox is "checked".
/// </summary>
[Setting("Show Label", Description = "Indicate whether the the field's label should be shown when rendering the form.", View = "checkbox", PreValues = "true", DisplayOrder = 20)]
public string ShowLabel { get; set; } = string.Empty;

/// <inheritdoc/>
public override bool HideLabel => ShowLabel == "False"; // Checking explicitly for false so the backward compatible default is to show the label.

@bjarnef
Copy link
Author

bjarnef commented Jul 13, 2022

Thanks, it would has been great it this was inherited though the get same label and description.
But I this is how it works at the moment and to be backward compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants