-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Property editors: Add configuration and validation of allowed types for element picker, document picker, media picker #23026
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
Merged
AndyButland
merged 31 commits into
main
from
v18/feature/element-picker-configuration-allowed-types
Jun 13, 2026
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
acbd2ae
add allowed type for element picker
LanThuyNguyen edb2e1b
update validation and unit test
LanThuyNguyen 6e1cac4
remove redundant code
LanThuyNguyen fe2758b
update tests name
LanThuyNguyen 40b0d5f
Merge branch 'main' into v18/feature/element-picker-configuration-all…
NguyenThuyLan ffd2376
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen a4b4abc
Merge branch 'v18/feature/element-picker-configuration-allowed-types'…
LanThuyNguyen 88f2e6f
revert code GetReferences
LanThuyNguyen b292b40
remove un-using code and add more check value
LanThuyNguyen b5ef4fa
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen 60c015a
remove redundant param
LanThuyNguyen 2e353b3
add allowed type for content picker, update validation
LanThuyNguyen 00fd2fe
add min max validation into element and its unit test
LanThuyNguyen e263f7f
update media picker validation
LanThuyNguyen 8a603fd
split validation runner into other class
LanThuyNguyen 6119e7f
update SystemTextJsonSerializerBase back to old code
LanThuyNguyen ee9fbdc
update unit tests
LanThuyNguyen 97cbe4c
Resolved some code warnings.
AndyButland f5c853c
Remove accidentally committed file
AndyButland 3c5b47b
Introduce ITypedValidator and obsolete ITypeJsonValidator to better r…
AndyButland 35a9e72
Merge remote-tracking branch 'origin/main' into v18/feature/element-p…
AndyButland e179718
Extraced ParseAllowedContentTypeKeys into a common helper.
AndyButland df760d4
Aligned parameters on AllowedTypeValidator.
AndyButland d059914
Align parsing of allowed type Ids on client between document and medi…
AndyButland bf18a0b
Restored validation of media where provided key can't be retrieved.
AndyButland 376e6f5
Aligned document, media and element configuration labels and weights.
AndyButland a714ec8
Added additional unit tests.
AndyButland de26982
Addressed code review comments.
AndyButland 64e8ed2
Resolved further code warnings and code tidy.
AndyButland 8d5623e
Resolve potential binary breaking change concern with obsolete ITyped…
AndyButland 02eedd8
Reuse shared DocumentTypePicker for picker allowed-types config.
AndyButland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Umbraco.Core/PropertyEditors/AllowedContentTypeKeysParser.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| using Umbraco.Extensions; | ||
|
|
||
| namespace Umbraco.Cms.Core.PropertyEditors; | ||
|
|
||
| /// <summary> | ||
| /// Parses the comma-separated content type keys stored in a picker's "allowed content types" configuration value | ||
| /// (e.g. <see cref="ContentPickerConfiguration.AllowedContentTypeIds"/> or <see cref="ElementPickerConfiguration.AllowedContentTypeIds"/>). | ||
| /// </summary> | ||
| internal static class AllowedContentTypeKeysParser | ||
| { | ||
| /// <summary> | ||
| /// Parses the configured value into the set of allowed content type keys. | ||
| /// </summary> | ||
| /// <param name="configValue">The comma-separated configuration value. Non-GUID entries are ignored.</param> | ||
| /// <returns>The set of allowed content type keys, or an empty set when nothing is configured.</returns> | ||
| public static HashSet<Guid> Parse(string? configValue) | ||
| { | ||
| if (configValue.IsNullOrWhiteSpace()) | ||
| { | ||
| return []; | ||
| } | ||
|
|
||
| var result = new HashSet<Guid>(); | ||
| foreach (var entry in configValue.Split(Constants.CharArrays.Comma, StringSplitOptions.RemoveEmptyEntries)) | ||
| { | ||
| if (Guid.TryParse(entry, out Guid guid)) | ||
| { | ||
| result.Add(guid); | ||
| } | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.