【发布时间】:2016-04-25 12:16:23
【问题描述】:
组件对话框有一个路径字段小部件,作者可以在其中设置页面路径。在 Sightly 组件中,我想查找该页面资源并从中获取(并显示)属性。
对话框...
<linkedPathLocation jcr:primaryType="cq:Widget"
fieldLabel="Linked Path"
name="./linkedPathLocation"
xtype="pathfield"
fieldDescription="Select a page. URL, Title, Description and Image are properties of the selected page"/>
我想工作的组件代码(不是)。
<div class="row" data-sly-resource.page = "${properties.linkedPathLocation}">
<h1 >${page.title}</h1>
<p>${page.description}</p>
</div>
我的问题:有没有办法在 Sightly 中解决和使用给定路径中的某些资源?如果没有,我可以创建一个 USE-API 类并执行以下操作...
Page page = resourceResolver.resolve("/path/to/resource").adaptTo(Page.class);
【问题讨论】: