Uploaded image for project: 'Magnolia Standard Templating Kit (closed)'
  1. Magnolia Standard Templating Kit (closed)
  2. MGNLSTK-780

Ability to define parameters on an Area

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Neutral Neutral
    • 2.0
    • 1.4.4
    • templates
    • Yes

      Hi,

      Sometimes it would be useful to configure generic parameters into the config for an Area, similar to the current ability to do this at the Paragraph level. Example use case would be able to apply different values to a divClass parameter to populate the class attribute in mainArea.ftl. One template definition could define this value as simply text, while another, (say a News Template that supports the hNews microformat), could define it as text hnews hentry item.

      Example mainArea.ftl
      [#assign divClass = def.mainArea.parameters.divClass]
      
      <div class="${divClass}">
          [#include "/templating-kit/templates/global/mainArea.ftl"]
      </div><!-- end text -->
      
      [#-- commenting --]
      [#if content[def.mainArea.comments.paragraph]?has_content]
          [@cms.includeTemplate contentNodeName="${def.mainArea.comments.paragraph}" /]
      [#else]
          [#if mgnl.editMode]
              <div style="padding-top: 20px;">
                  [@cms.newBar contentNodeName="${def.mainArea.comments.paragraph}" paragraph="${def.mainArea.comments.paragraph}" newLabel="${i18n['comments.newLabel']}" /]
              </div>
          [/#if]
      [/#if]
      
      

      Possible patch is attached. Needs to be tested before applying.

      Please let me know if you have any questions.

      Cheers,
      Matt

        Acceptance criteria

              pbaerfuss Philipp Bärfuss
              mderting Matt Dertinger
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: