Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3209

pageIterator no longer works unless the current node is a page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.3.2
    • 4.3, 4.3.1, 4.2.4
    • None
    • None
    • Yes

      This is related to MAGNOLIA-2851 and MAGNOLIA-3007. In the latter PageIterator.initContentIterator() was changed to begin with:

      Content activePage = MgnlContext.getAggregationState().getCurrentContent();
      

      This means that if you use the tag while a non-page content node is active, it will come up blank. That struck me as very odd when I ran across it. It seems more appropriate to change it to this:

      Content activePage = MgnlContext.getAggregationState().getCurrentContent();
      try {
        while (!activePage.getItemType().equals(ItemType.CONTENT)) {
          activePage = activePage.getParent();
        }
      } catch (Exception e) {
        // oh well
      }
      

      This will search up the tree until we find the page we're on, then iterate over its subpages. The try/catch is there because getParent() can throw JCR exceptions.

        Acceptance criteria

              pbaerfuss Philipp Bärfuss
              nwing Nickolaus Wing
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: