How to use a module's property in an other module in Jahia 7?

172 Views Asked by At

As mentioned in the title, I have different modules that I use in a template and I want to use a module's property in an other module. Is there a way to do it in Jahia 7 ?

1

There are 1 best solutions below

1
On

Yes, it's possible. The correct way to do that is to include a fragment view of the other module into the main/calling module.

  • Example:

Delegating rendering (Employee definition/module needs to render a field/views from Company definition/module)

mynt_employee/html/employee.jsp

    <h2>${currentNode.properties['jcr:title'].string}</h2>
    <h3>Company</h3>
    <template:module node="${currentNode.properties.company.node}" view="hidden.name" />

This code delegates the rendering of a company content to the company component

mynt_company/html/company.hidden.name.jsp - You just need to display the field that you want (here the title of Company):

    ${currentNode.properties['jcr:title'].string}