Let MenuItemNode and PageNode extend DatabaseObjectDecorator
authorMatthias Schmidt <gravatronics@live.com>
Thu, 12 May 2016 16:51:41 +0000 (18:51 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 12 May 2016 16:51:41 +0000 (18:51 +0200)
16 files changed:
com.woltlab.wcf/templates/__menu.tpl
com.woltlab.wcf/templates/pageMenuMobile.tpl
wcfsetup/install/files/acp/templates/boxAdd.tpl
wcfsetup/install/files/acp/templates/menuAdd.tpl
wcfsetup/install/files/acp/templates/menuItemAdd.tpl
wcfsetup/install/files/acp/templates/menuItemList.tpl
wcfsetup/install/files/acp/templates/pageAdd.tpl
wcfsetup/install/files/acp/templates/pageHeaderUser.tpl
wcfsetup/install/files/acp/templates/pageMenuMobile.tpl
wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php
wcfsetup/install/files/lib/acp/form/MenuItemAddForm.class.php
wcfsetup/install/files/lib/acp/form/MenuItemEditForm.class.php
wcfsetup/install/files/lib/data/menu/item/MenuItemNode.class.php
wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php
wcfsetup/install/files/lib/data/page/PageNode.class.php
wcfsetup/install/files/lib/system/condition/page/MultiPageCondition.class.php

index ceaa11660bde467a10c1fbe6c9ba5731687d6538..bc8e7b5897e8614ec1d84d10f06807abf3b6493c 100644 (file)
@@ -2,10 +2,10 @@
        <ol class="boxMenu">
                {foreach from=$menuItemNodeList item=menuItemNode}
                        <li class="{if $menuItemNode->isActiveNode()}active{/if}{if $menuItemNode->hasChildren()} boxMenuHasChildren{/if}">
-                               <a href="{$menuItemNode->getMenuItem()->getURL()}" class="boxMenuLink">
-                                       <span class="boxMenuLinkTitle">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</span>
-                                       {if $menuItemNode->getMenuItem()->getOutstandingItems() > 0}
-                                               <span class="boxMenuLinkOutstandingItems badge badgeUpdate">{#$menuItemNode->getMenuItem()->getOutstandingItems()}</span>
+                               <a href="{$menuItemNode->getURL()}" class="boxMenuLink">
+                                       <span class="boxMenuLinkTitle">{lang}{$menuItemNode->title}{/lang}</span>
+                                       {if $menuItemNode->getOutstandingItems() > 0}
+                                               <span class="boxMenuLinkOutstandingItems badge badgeUpdate">{#$menuItemNode->getOutstandingItems()}</span>
                                        {/if}
                                </a>
                                
index 1d97e3da99324698250c98e740c12768d32c81fd..eb12845ed7ed81e6dea80fabf45c62c16d8667eb 100644 (file)
@@ -10,9 +10,9 @@
                        <ol class="menuOverlayItemList">*}
                                {foreach from=$__wcf->getBoxHandler()->getBoxes('mainMenu')[0]->getMenu()->getMenuItemNodeList() item=menuItemNode}
                                        <li class="menuOverlayItem">
-                                               {assign var=__outstandingItems value=$menuItemNode->getMenuItem()->getOutstandingItems()}
-                                               <a href="{$menuItemNode->getMenuItem()->getURL()}" class="menuOverlayItemLink{if $__outstandingItems} menuOverlayItemBadge{/if}{if $menuItemNode->isActiveNode()} active{/if}">
-                                                       <span class="menuOverlayItemTitle">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</span>
+                                               {assign var=__outstandingItems value=$menuItemNode->getOutstandingItems()}
+                                               <a href="{$menuItemNode->getURL()}" class="menuOverlayItemLink{if $__outstandingItems} menuOverlayItemBadge{/if}{if $menuItemNode->isActiveNode()} active{/if}">
+                                                       <span class="menuOverlayItemTitle">{lang}{$menuItemNode->title}{/lang}</span>
                                                        {if $__outstandingItems}
                                                                <span class="badge badgeUpdate">{#$__outstandingItems}</span>
                                                        {/if}
index 31c29761770b7540392e28b17dd2fbda64a3f51b..86f0e3b9aaa3f91800d058163d494a38dec905bc 100644 (file)
                                <ul class="scrollableCheckboxList">
                                        {foreach from=$pageNodeList item=pageNode}
                                                <li{if $pageNode->getDepth() > 1} style="padding-left: {$pageNode->getDepth()*20-20}px"{/if}>
-                                                       <label><input type="checkbox" name="pageIDs[]" value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID|in_array:$pageIDs} checked="checked"{/if} /> {$pageNode->getPage()->name}</label>
+                                                       <label><input type="checkbox" name="pageIDs[]" value="{@$pageNode->pageID}"{if $pageNode->pageID|in_array:$pageIDs} checked="checked"{/if} /> {$pageNode->name}</label>
                                                </li>
                                        {/foreach}
                                </ul>
                                        <option value="0">{lang}wcf.global.noSelection{/lang}</option>
                                        
                                        {foreach from=$pageNodeList item=pageNode}
-                                               <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID == $linkPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $linkPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
                                        {/foreach}
                                </select>
                                {if $errorField == 'linkPageID'}
index f0420785873f587d20fe7b9ef9fbd9983cf9fdc8..023520371f9ef3c85d23a37694969ac8858f38be 100644 (file)
                                <dd>
                                        <select name="pageIDs[]" id="pageIDs" multiple="multiple" size="20">
                                                {foreach from=$pageNodeList item=pageNode}
-                                                       <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID|in_array:$pageIDs} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+                                                       <option value="{@$pageNode->pageID}"{if $pageNode->pageID|in_array:$pageIDs} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
                                                {/foreach}
                                        </select>
                                </dd>
index 13b1e001c824b181c5fe1b1b14339d5a7e062a55..820182bafeb58c1e179c76515f1d8837adf433f8 100644 (file)
@@ -48,7 +48,7 @@
                                        <option value="0">{lang}wcf.global.noSelection{/lang}</option>
                                        
                                        {foreach from=$menuItemNodeList item=menuItemNode}
-                                               <option value="{@$menuItemNode->getMenuItem()->itemID}"{if $menuItemNode->getMenuItem()->itemID == $parentItemID} selected="selected"{/if}>{if $menuItemNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($menuItemNode->getDepth() - 1)}{/if}{lang}{$menuItemNode->getMenuItem()->title}{/lang}</option>
+                                               <option value="{@$menuItemNode->itemID}"{if $menuItemNode->itemID == $parentItemID} selected="selected"{/if}>{if $menuItemNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($menuItemNode->getDepth() - 1)}{/if}{lang}{$menuItemNode->title}{/lang}</option>
                                        {/foreach}
                                </select>
                                {if $errorField == 'parentItemID'}
                                        <option value="0">{lang}wcf.global.noSelection{/lang}</option>
                                        
                                        {foreach from=$pageNodeList item=pageNode}
-                                               <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID == $pageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $pageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
                                        {/foreach}
                                </select>
                                {if $errorField == 'pageID'}
index f5c821412074d01d5499ff601f419dd604d6a087..6bf2ce760e2fee9c2e344ef5697614e1f02bc2b7 100644 (file)
                <ol class="sortableList" data-object-id="0">
                        {content}
                                {foreach from=$menuItemNodeList item=menuItemNode}
-                                       <li class="sortableNode" data-object-id="{@$menuItemNode->getMenuItem()->itemID}">
+                                       <li class="sortableNode" data-object-id="{@$menuItemNode->itemID}">
                                                <span class="sortableNodeLabel">
-                                                       <a href="{link controller='MenuItemEdit' id=$menuItemNode->getMenuItem()->itemID}{/link}">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</a>
+                                                       <a href="{link controller='MenuItemEdit' id=$menuItemNode->itemID}{/link}">{lang}{$menuItemNode->title}{/lang}</a>
                                                        <span class="statusDisplay sortableButtonContainer">
-                                                               {if $menuItemNode->getMenuItem()->canDisable()}
-                                                                       <span class="icon icon16 fa-{if !$menuItemNode->getMenuItem()->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if $menuItemNode->getMenuItem()->isDisabled}enable{else}disable{/if}{/lang}" data-object-id="{@$menuItemNode->getMenuItem()->itemID}"></span>
+                                                               {if $menuItemNode->canDisable()}
+                                                                       <span class="icon icon16 fa-{if !$menuItemNode->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if $menuItemNode->isDisabled}enable{else}disable{/if}{/lang}" data-object-id="{@$menuItemNode->itemID}"></span>
                                                                {else}
-                                                                       <span class="icon icon16 fa-{if !$menuItemNode->getMenuItem()->isDisabled}check-{/if}square-o disabled" title="{lang}wcf.global.button.{if $menuItemNode->getMenuItem()->isDisabled}enable{else}disable{/if}{/lang}"></span>
+                                                                       <span class="icon icon16 fa-{if !$menuItemNode->isDisabled}check-{/if}square-o disabled" title="{lang}wcf.global.button.{if $menuItemNode->isDisabled}enable{else}disable{/if}{/lang}"></span>
                                                                {/if}
-                                                               <a href="{link controller='MenuItemEdit' id=$menuItemNode->getMenuItem()->itemID}{/link}" class="jsTooltip" title="{lang}wcf.global.button.edit{/lang}"><span class="icon icon16 fa-pencil"></span></a>
-                                                               {if $menuItemNode->getMenuItem()->canDelete()}
-                                                                       <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$menuItemNode->getMenuItem()->itemID}" data-confirm-message="{lang menuItem=$menuItemNode->getMenuItem()}wcf.acp.menu.item.delete.confirmMessage{/lang}"></span>
+                                                               <a href="{link controller='MenuItemEdit' id=$menuItemNode->itemID}{/link}" class="jsTooltip" title="{lang}wcf.global.button.edit{/lang}"><span class="icon icon16 fa-pencil"></span></a>
+                                                               {if $menuItemNode->canDelete()}
+                                                                       <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$menuItemNode->itemID}" data-confirm-message="{lang menuItem=$menuItemNode->getMenuItem()}wcf.acp.menu.item.delete.confirmMessage{/lang}"></span>
                                                                {else}
                                                                        <span class="icon icon16 fa-times disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
                                                                {/if}
@@ -50,7 +50,7 @@
                                                        </span>
                                                </span>
                                        
-                                               <ol class="sortableList" data-object-id="{@$menuItemNode->getMenuItem()->itemID}">{if !$menuItemNode->hasChildren()}</ol></li>{/if}
+                                               <ol class="sortableList" data-object-id="{@$menuItemNode->itemID}">{if !$menuItemNode->hasChildren()}</ol></li>{/if}
                                                
                                                {if !$menuItemNode->hasChildren() && $menuItemNode->isLastSibling()}
                                                        {@"</ol></li>"|str_repeat:$menuItemNode->getOpenParentNodes()}
index e2b36d87aed0101107585303293692ad676659fc..6b39aa48be19464d9c059029dd2735fb7ed1128f 100644 (file)
@@ -72,7 +72,7 @@
                                        <option value="0">{lang}wcf.acp.page.parentPageID.noParentPage{/lang}</option>
                                        
                                        {foreach from=$pageNodeList item=pageNode}
-                                               <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID == $parentPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()->name}</option>
+                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $parentPageID} selected="selected"{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
                                        {/foreach}
                                </select>
                                {if $errorField == 'parentPageID'}
index 9fc436451d3dfcfce933c52edf0574f0f1ccd9bd..a058a9f2aac2c95077b9cc13bc3bff8c4ee0d46b 100644 (file)
@@ -20,8 +20,8 @@
                                        <a href="{link forceFrontend=true}{/link}" class="dropdownToggle jsTooltip" title="{lang}wcf.global.jumpToPage{/lang}"><span class="icon icon32 fa-home"></span></a>
                                        <ul class="dropdownMenu" data-dropdown-alignment-horizontal="right">
                                                {foreach from=$__wcf->getFrontendMenu()->getMenuItemNodeList() item=_menuItem}
-                                                       {if !$_menuItem->getMenuItem()->parentItemID && $_menuItem->getMenuItem()->getPage()}
-                                                               <li><a href="{$_menuItem->getMenuItem()->getPage()->getLink()}">{$_menuItem->getMenuItem()->getPage()}</a></li>
+                                                       {if !$_menuItem->parentItemID && $_menuItem->getPage()}
+                                                               <li><a href="{$_menuItem->getPage()->getLink()}">{$_menuItem->getPage()}</a></li>
                                                        {/if}
                                                {/foreach}
                                        </ul>
index b65583287a834f045ec22116f50a2e291a302bd3..9232702b72438015cce5896eb39fd16a1247cf50 100644 (file)
@@ -51,8 +51,8 @@
                        </a>
                        <ol class="menuOverlayItemList">
                                {foreach from=$__wcf->getFrontendMenu()->getMenuItemNodeList() item=_menuItem}
-                                       {if !$_menuItem->getMenuItem()->parentItemID && $_menuItem->getMenuItem()->getPage()}
-                                               <li class="menuOverlayItem"><a href="{$_menuItem->getMenuItem()->getPage()->getLink()}" class="menuOverlayItemLink">{$_menuItem->getMenuItem()->getPage()}</a></li>
+                                       {if !$_menuItem->parentItemID && $_menuItem->getPage()}
+                                               <li class="menuOverlayItem"><a href="{$_menuItem->getPage()->getLink()}" class="menuOverlayItemLink">{$_menuItem->getPage()}</a></li>
                                        {/if}
                                {/foreach}
                        </ol>
index 0704dee86756e9a42a06340b7fba7068124a84d8..f8b74b6477ac42cbeb6e758afff27d3adc8d29c5 100644 (file)
@@ -179,10 +179,10 @@ class BoxAddForm extends AbstractForm {
                
                // fetch page handlers
                foreach ($this->pageNodeList as $pageNode) {
-                       $handler = $pageNode->getPage()->getHandler();
+                       $handler = $pageNode->getHandler();
                        if ($handler !== null) {
                                if ($handler instanceof ILookupPageHandler) {
-                                       $this->pageHandlers[$pageNode->getPage()->pageID] = $pageNode->getPage()->requireObjectID;
+                                       $this->pageHandlers[$pageNode->pageID] = $pageNode->requireObjectID;
                                }
                        }
                }
index 58254ff6ac9d6508b63d8f37bc3dc0b82cb0494c..54e91393f65d19035d9f5e630e92d257e1e2aa9f 100644 (file)
@@ -134,10 +134,10 @@ class MenuItemAddForm extends AbstractForm {
                
                // fetch page handlers
                foreach ($this->pageNodeList as $pageNode) {
-                       $handler = $pageNode->getPage()->getHandler();
+                       $handler = $pageNode->getHandler();
                        if ($handler !== null) {
                                if ($handler instanceof ILookupPageHandler) {
-                                       $this->pageHandlers[$pageNode->getPage()->pageID] = $pageNode->getPage()->requireObjectID;
+                                       $this->pageHandlers[$pageNode->pageID] = $pageNode->requireObjectID;
                                }
                        }
                }
index 9942216532dd1d0ea31d26a1b955f118b387119c..7b132741709eaef1d3c49824c979770916aa1db9 100644 (file)
@@ -56,10 +56,10 @@ class MenuItemEditForm extends MenuItemAddForm {
                
                // fetch page handlers
                foreach ($this->pageNodeList as $pageNode) {
-                       $handler = $pageNode->getPage()->getHandler();
+                       $handler = $pageNode->getHandler();
                        if ($handler !== null) {
                                if ($handler instanceof ILookupPageHandler) {
-                                       $this->pageHandlers[$pageNode->getPage()->pageID] = $pageNode->getPage()->requireObjectID;
+                                       $this->pageHandlers[$pageNode->pageID] = $pageNode->requireObjectID;
                                }
                        }
                }
index c732f1765613aa2f8665d3e92ea45b632792246c..e0f8cace6c1d3290012a5c24ca17d981617889b0 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\menu\item;
+use wcf\data\DatabaseObjectDecorator;
 
 /**
  * Represents a menu item node element.
@@ -11,8 +12,11 @@ namespace wcf\data\menu\item;
  * @subpackage data.menu.item
  * @category   Community Framework
  * @since      2.2
+ * 
+ * @method     MenuItem        getDecoratedObject()
+ * @mixin      MenuItem
  */
-class MenuItemNode implements \Countable, \RecursiveIterator {
+class MenuItemNode extends DatabaseObjectDecorator implements \Countable, \RecursiveIterator {
        /**
         * children of this node
         * @var MenuItemNode[]
@@ -31,12 +35,6 @@ class MenuItemNode implements \Countable, \RecursiveIterator {
         */
        protected $isActive = false;
        
-       /**
-        * menu item object
-        * @var MenuItem
-        */
-       protected $menuItem;
-       
        /**
         * parent node
         * @var MenuItemNode
@@ -49,6 +47,11 @@ class MenuItemNode implements \Countable, \RecursiveIterator {
         */
        private $position = 0;
        
+       /**
+        * @inheritDoc
+        */
+       protected static $baseClass = MenuItem::class;
+       
        /**
         * Creates a new MenuItemNode object.
         * 
@@ -57,8 +60,12 @@ class MenuItemNode implements \Countable, \RecursiveIterator {
         * @param       integer                 $depth
         */
        public function __construct($parentNode = null, MenuItem $menuItem = null, $depth = 0) {
+               if ($menuItem === null) {
+                       $menuItem = new MenuItem(null, []);
+               }
+               parent::__construct($menuItem);
+               
                $this->parentNode = $parentNode;
-               $this->menuItem = $menuItem;
                $this->depth = $depth;
        }
        
@@ -80,15 +87,6 @@ class MenuItemNode implements \Countable, \RecursiveIterator {
                return $this->parentNode;
        }
        
-       /**
-        * Returns the menu item object of this node.
-        * 
-        * @return      MenuItem
-        */
-       public function getMenuItem() {
-               return $this->menuItem;
-       }
-       
        /**
         * Returns the number of children.
         * 
index 8a3209a5b59dd61056021bbd5fc538c6a6a2756e..cc1b67919915db152d00cdd9dfa95101b7e0cf3f 100644 (file)
@@ -102,7 +102,7 @@ class MenuItemNodeTree {
                                for ($i = 0, $length = count($itemIDs); $i < $length; $i++) {
                                        /** @var MenuItemNode $node */
                                        foreach ($nodeList as $node) {
-                                               if ($node->getMenuItem()->itemID == $itemIDs[$i]) {
+                                               if ($node->itemID == $itemIDs[$i]) {
                                                        $node->setIsActive();
                                                        
                                                        // only one effective item can be marked as active, use the first
index 21ebd52bb1e2fd282e04b2576f6fc9aff3030b0d..1852df46f811e28229d1e20fe461ae66fba3381a 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\page;
+use wcf\data\DatabaseObjectDecorator;
 
 /**
  * Represents a page node element.
@@ -11,8 +12,11 @@ namespace wcf\data\page;
  * @subpackage data.page
  * @category   Community Framework
  * @since      2.2
+ * 
+ * @method     Page    getDecoratedObject()
+ * @mixin      Page
  */
-class PageNode implements \Countable, \RecursiveIterator {
+class PageNode extends DatabaseObjectDecorator implements \Countable, \RecursiveIterator {
        /**
         * parent node
         * @var PageNode
@@ -23,13 +27,7 @@ class PageNode implements \Countable, \RecursiveIterator {
         * children of this node
         * @var PageNode[]
         */
-       protected $children = array();
-       
-       /**
-        * page object
-        * @var Page
-        */
-       protected $page = null;
+       protected $children = [];
        
        /**
         * node depth
@@ -43,6 +41,11 @@ class PageNode implements \Countable, \RecursiveIterator {
         */
        private $position = 0;
        
+       /**
+        * @inheritDoc
+        */
+       protected static $baseClass = Page::class;
+       
        /**
         * Creates a new PageNode object.
         * 
@@ -51,8 +54,12 @@ class PageNode implements \Countable, \RecursiveIterator {
         * @param       integer         $depth
         */
        public function __construct($parentNode = null, Page $page = null, $depth = 0) {
+               if ($page === null) {
+                       $page = new Page(null, []);
+               }
+               parent::__construct($page);
+               
                $this->parentNode = $parentNode;
-               $this->page = $page;
                $this->depth = $depth;
        }
        
@@ -74,15 +81,6 @@ class PageNode implements \Countable, \RecursiveIterator {
                return $this->parentNode;
        }
        
-       /**
-        * Returns the page object of this node
-        * 
-        * @return      Page
-        */
-       public function getPage() {
-               return $this->page;
-       }
-       
        /**
         * Returns the number of children.
         * 
index 766e5b7cd4d0756150514517ae86cf28da5d0160..e4830d9481bbadabb0c677c72e67039eaa61d9a6 100644 (file)
@@ -45,7 +45,7 @@ class MultiPageCondition extends AbstractMultiSelectCondition implements IConten
                $fieldElement = '<select name="'.$this->fieldName.'[]" id="'.$this->fieldName.'" multiple="multiple" size="10">';
                /** @var PageNode $pageNode */
                foreach ($pageNodes as $pageNode) {
-                       $fieldElement .= '<option value="'.$pageNode->getPage()->pageID.'">'.($pageNode->getDepth() > 1 ? str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $pageNode->getDepth() - 1) : '').$pageNode->getPage()->name.'</option>';
+                       $fieldElement .= '<option value="'.$pageNode->pageID.'">'.($pageNode->getDepth() > 1 ? str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $pageNode->getDepth() - 1) : '').$pageNode->name.'</option>';
                }
                $fieldElement .= "</select>";