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

Paragraphs using the tocMacro.ftl are not usable as subparagraphs or from nested calls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.3.2
    • 1.3.1
    • paragraphs
    • None

    Description

      The paragraphs 'stkTextImage' and 'stkLinkList' include the macro tocMarkup.ftl:
      include "/templating-kit/paragraphs/macros/tocMarkup.ftl"/

      The macro tries to read out the pages renderable definition, but does that wrong:
      assign intro = model.parent.def.mainArea.intro

      this works as long the parent model of the paragraph is a page's model.
      But when the paragraph is a subparagraph, the call model.parent will return a renderable definition of a paragraph and not of a page.

      the correct solution is:

      macro tocMarkup model content

      assign rootDef = model.root.def!false

      if rootDef.mainArea?if_exists
      assign showTOC = rootDef.mainArea.intro.showTOC!false
      else
      assign showTOC = false
      /#if

      assign siblings=mgnl.siblings(content)

      if showTOC
      assign id='id="jump' + (siblings.index + 1) + '"'
      else
      assign id=""
      /#if

      /#macro

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                cringele Christian Ringele
                cringele Christian Ringele
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: