How can that be changed to allow for other types of input?
Here is an example of a multifield whose inner widget’s xtype is pathfield:
Problem: To create a multifield, a new widget of xtype multifield me be created. But xtype is traditionally what defines the input type, so we can’t change that directly.
Solution: Create another widget inside the multifield called fieldConfig and use that to customize the widget.
Here is an example of a multifield whose inner widget’s xtype is pathfield:
Problem: To create a multifield, a new widget of xtype multifield me be created. But xtype is traditionally what defines the input type, so we can’t change that directly.
Solution: Create another widget inside the multifield called fieldConfig and use that to customize the widget.
The node images are the multifield xtype. It’s where the name, in this case, ./images, is specified. Within that widget node, create another widget node named fieldConfig. Specify additional properties, like xtype: pathfield within that node.
Extracting the properties: retrieving data stored in this field is done in the same manner as standard multifield components.
Example:
<%@include file="/libs/foundation/global.jsp"%>
Multifield Test Component<br/>
<%
// String[] images = properties.get("images", String[].class); // default is null
String[] images = properties.get("images", new String[0]); // default is empty array
for (int i = 0; i < images.length; i++) {
%>
<img src="<%= images[i] %>"></img><br/>
<%
}
%>
Resources:
Package for example component, multifieldTestComponent
Summary: AEM’s built-in multifield widget is surprisingly customizable. There’s no need to go creating custom xtypes just to configure this widget.
Extracting the properties: retrieving data stored in this field is done in the same manner as standard multifield components.
Example:
<%@include file="/libs/foundation/global.jsp"%>
Multifield Test Component<br/>
<%
// String[] images = properties.get("images", String[].class); // default is null
String[] images = properties.get("images", new String[0]); // default is empty array
for (int i = 0; i < images.length; i++) {
%>
<img src="<%= images[i] %>"></img><br/>
<%
}
%>
Resources:
Package for example component, multifieldTestComponent
Summary: AEM’s built-in multifield widget is surprisingly customizable. There’s no need to go creating custom xtypes just to configure this widget.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.