Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-120320

Inject editable fields into freemarker as variables if requested by editable


    • Feature Request
    • Status: Under Review
    • Minor
    • Resolution: Unresolved
    • None
    • None


      One of the major caveats of editables is that the value (length or lack thereof) is not available in freemarker.

      There are several usecases attached to that.

      a) It would make it possible to test if the field is empty (useful for mapped fields)

      b) The field content could be used in freemarker to display it in a different way. e.g. an editfield could be used to enter an email address. But when in view mode, a mailto link is shown.

      c) It would make the value available to be used as an anchor. We had the request that it should be possible to jump to the headings on a page. But editors always forgot to enter the anchor tag in the configuration. Were the entered text available, we could sanitize it (we did that before) and automatically use it as an anchor.

      d) It would make the field available in multiple places and in freemarker.

      This could be useful for responsive design, to rearrange content. We have a tool that allows me to request optimized images for various resolutions. If I had the url of the image available, I could use it to generate the links.

      Or, in the example with the anchor, we could use the generated anchor as a link for a "direct link to this paragrah"

      Note: We currently have solved this by implementing our own fragment renderer with render weight 0. It picks up all editables with an attribute "freemarkerVar=myImage" and injects a freemarker assign directive with that variable into the template.


        Issue Links



              mateo.hermosin Mateo Hermosin
              crabel Christoph Rabel
              1 Vote for this issue
              4 Start watching this issue




                  Version Package