Skip to content

Commit b701735

Browse files
authored
Detailed the additional arguments available in processValue with property value presets.
1 parent 0daf631 commit b701735

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

16/umbraco-cms/customizing/extending-overview/extension-types/property-value-preset.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ This API will set the value to "Hello there" for all properties using the `Umb.P
3838

3939
### Target a Property Editor Schema
4040

41-
You can also choose to target your Preset for a Property Editor Schema.\
42-
\
41+
You can also choose to target your Preset for a Property Editor Schema.
42+
4343
Define `forPropertyEditorSchemaAlias` to show the Preset Value for all Properties based on that Schema.
4444

4545
If both `forPropertyEditorSchemaAlias` and `forPropertyEditorUiAlias` are defined, it will not limit the target. The matching is independently for each of them.
@@ -48,7 +48,11 @@ Notice that `forPropertyEditorSchemaAlias` only targets the Properties used on t
4848

4949
## Utilize the Data-Type configuration
5050

51-
The `processValue` method takes two arguments, the current value of the Preset and the Data-Type Configuration.
51+
The `processValue` method takes four arguments:
52+
- The current value.
53+
- The Data Type configuration.
54+
- The type arguments, which contains details such as whether the property is mandatory, and how it varies by culture and segment.
55+
- The call arguments, which contains details about the property and document.
5256

5357
The following example is the built-in Property Value Preset for the Umbraco Toggle. The Toggle Data Type has a 'preset state' configuration that is used as the value of the Toggle.
5458

@@ -57,7 +61,7 @@ The following example is the built-in Property Value Preset for the Umbraco Togg
5761
export class UmbTrueFalsePropertyValuePreset
5862
implements UmbPropertyValuePreset<UmbTogglePropertyEditorUiValue, UmbPropertyEditorConfig>
5963
{
60-
async processValue(value: undefined | UmbTogglePropertyEditorUiValue, config: UmbPropertyEditorConfig) {
64+
async processValue(value: undefined | UmbTogglePropertyEditorUiValue, config: UmbPropertyEditorConfig, typeArgs: UmbPropertyTypePresetModelTypeModel, callArgs: UmbPropertyValuePresetApiCallArgs) {
6165
const initialState = (config.find((x) => x.alias === 'presetState')?.value as boolean | undefined) ?? false;
6266
return value !== undefined ? value : initialState;
6367
}

0 commit comments

Comments
 (0)