How to set a link to be applied to the whole fragment
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- Sometimes, the need of establishing a link that applies to the whole fragment arises.
- The first idea that might come up is usually to use nested editable fields. However, nested editable fields are not supported.
Resolution
- There would be two alternative ways to achieve this:
- Use the container fragment to gather all the elements that correspond to the link, and use the "Link" Container Option to map the container to the convenient URL.
- Use the recently created URL configuration type added in LPS-164081 and LPS-164123 available since Update 45. In this case, a new configuration field of type url should be added to the fragment's configuration. Once done this, then the value configured by the user could be referenced as a FreeMarker variable in the href attribute of the anchor which wraps the editable field values:
<div>
<div class="card">
<a href="${configuration.myurl}">
<div class="card-body">
<div class="upper">
<h2 data-lfr-editable-id="title" data-lfr-editable-type="text">Header</h2>
</div>
<div>
<p data-lfr-editable-id="description" data-lfr-editable-type="text">Description</p>
</div>
</div>
</a>
</div>
</div>
Did this article resolve your issue ?