Skip navigation

CQ5

Currently Being Moderated

How can I create a design dialog for a component that is site wide and not bound to a templates?

Jul 2, 2012 1:54 PM

How would I use design dialogs on a componet to create a global setting and not a setting that is bound per template?  I want to save a property for a component globably and not have 5 different references if I have 5 templates.  How can I create a component that has a global configurable setting?

 
Replies
  • Currently Being Moderated
    Jul 3, 2012 8:07 AM   in reply to stewa52

    We've sometimes used inheritance in cases like this - check for the value in the current page and if it doesn't exist, check for the value in the getAbsoluteParent(2) page node. The down side of this is a bit of node walking and a lot of null checking.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 3, 2012 9:29 AM   in reply to stewa52

    One approach would be to have multiple templates using the same design. That would allow you to use a design dialog for this.

     

    Another approach is to have an absolutely referenced global node. So your tag looks like <cq:include path="/content/siteName/globalText" resourceType="appName/components..." />. Obviously you may need to have sort of a wrapper component if the intent is to use this to be dragged onto a parsys.

     

    Actually, you might be able to use an absolute path in the "name" property of your dialog widget. I haven't tried that...

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 6:11 AM   in reply to stewa52

    You're right, that is how the nodes are set up, but I could've sworn I'd gotten that to work before... The second approach is one I'm using for my current project.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 7:01 AM   in reply to stewa52

    Yes, by default data in design mode are stored separately per template.

     

    For example there is logo component in sample geometrixx app which also stores logo per template,

     

    At the same time there is inheritance implemented in design mode, so if all your templates inherits from some basic/abstract template (in case of geometrixx it is 'page' template) you can store design properties once and they will be inherited by all templates.

     

    I think what you can do is to override the path where data is stored, e.g. in logo.jsp component you can do that by settingt content path on editContext variable

     

    <%

        editContext.setContentPath("/etc/designs/geometrixx/jcr:content/page/ logo");

    %>

     

    from now data will be stored under given path regardless of actual template used (here under 'abstract' page template)

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points