[MAGNOLIA-3209] pageIterator no longer works unless the current node is a page Created: 21/May/10  Updated: 23/Jan/13  Resolved: 21/May/10

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 4.3, 4.3.1, 4.2.4
Fix Version/s: 4.3.2

Type: Bug Priority: Major
Reporter: Nickolaus Wing Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MAGNOLIA-3007 PageIterator tag wrongly iterates on ... Closed
supersession
supersedes MAGNOLIA-2851 PageIterator tag wrongly iterates ove... Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

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.


Generated at Mon Feb 12 03:44:15 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.