Edit in GitHubLog an issue

Custom form element rendering

This feature allows third-party developer to build custom input UI for specific fields or types of fields.

Define override rules

An UIX extension can define a list of override rules, each consisting of a set of RegExp expressions for field name, type, fragment path or/and model path. When a field on the canvas matches one of these expressions, the standard UI is replaced with an iframe, which then renders the custom UI provided by the extension.

Copied to your clipboard
function ExtensionRegistration() {
const init = async () => {
const guestConnection = await register({
id: extensionId,
methods: {
field: {
getDefinitions: () => {
return [
{
fieldNameExp: '^address_autocomplete$',
url: '/#/address-autocomplete-field',
},
];
},
},
},
});
};
init().catch(console.error);
return <Text>IFrame for integration with Host (AEM)...</Text>;
}

Implement custom rendering logic

Copied to your clipboard
function CustomField() {
...
useEffect(() => {
const init = async () => {
// connect to the host (ie. CF Editor)
const conn = await attach({ id: extensionId });
setConnection(conn);
// get model
const model = await conn.host.field.getModel();
// configure validation state subscriber
await conn.host.field.onValidationStateChange((state) => setValidationState(state));
// get default value
const defaultValue = await conn.host.field.getDefaultValue();
}
init().catch(console.error);
}, []);
// Custom fileld will be display instead of original one
return <TextField defaultValue={value} onChange={(v) => conn.host.field.onChange(v)} ... />;
}

API Reference

FieldTypeRequiredDescription
url
string
✔️
URL of the page to load in the iframe that will replace the original field. The URL must have the same origin as the extension declaring the rules for field replacement.
pathExp
string
RegExp for "fragment content" path
modelPathExp
string
RegExp for "fragment content model" path
fieldTypeExp
string
RegExp for field type
fieldNameExp
string
RegExp for field name
overlay
boolean
Default "false". Render a field in absolute positioning. Useful in cases when field has content that should be rendered on top of mainframe content, as an example dropdown element.

At least one valid expression must be specified: pathExp, modelPathExp, fieldTypeExp, or fieldNameExp.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.