I have aem component and Sling model with three injected fields corresponding to dialog fields in component. Only value of headline
field is shown on the component. I tried to change the type of other fields to textfield, but that didn't make any effect. I don't see any other difference among my fields.
Here is Java class:
@Model(
adaptables = {SlingHttpServletRequest.class},
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL
)
public class ArticlePreviewImpl implements ArticlePreview {
@Inject
private String contentpath;
@Inject
private String headline;
@Inject
private String elements;
@Override
public String getContentpath() {
return contentpath;
}
@Override
public String getHeadline() {
return headline;
}
@Override
public String getElements() {
return elements;
}
}
Here is HTL:
<!--/* articlepreview.html */-->
<div class="cmp-apreview"
data-sly-use.apreview="com.training.core.models.ArticlePreview">
path: ${apreview.contentPath}<br/>
headline: ${apreview.headline}<br/>
elements: ${apreview.elements}
</div>
<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html"></sly>
<sly data-sly-call="${clientlib.js @ categories='cq.authoring.dialog, training.components'}"></sly>
Here are definitions of dialog fields from .content.xml:
<contentPath
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldLabel="Path to directory with content"
name="./contentpath"/>
...
<headline
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
emptyText="Enter the headline to display."
fieldLabel="Headline"
name="./headline"/>
...
<elements
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/numberfield"
defaultValue="3"
fieldDescription="Number of elements in one portion"
fieldLabel="Number of elements in one portion"
max="{Double}15.0"
min="{Double}1.0"
name="./elements"
value="3"/>
Only value of apreview.headline
is shown on the component, the two others are not.
It was very easy and stupid - I pushed HTL into repository instead of building entire project