I wrote a module that has a bit of a complicated structure with parents and children to be created in the site tree.
All worked fine in the previous version of Silverstripe, but the new one (version 3) is giving me the following error...
Any help from you guys?
ERROR [Warning]: Invalid argument supplied for foreach() IN GET /index.php/admin/pages/treeview Line 2388 in /home/website/public_html/itela.org/cms/code/model/SiteTree.php Source ====== 2379: * Returns an array of the class names of classes that are allowed 2380: * to be children of this class. 2381: * 2382: * @return array 2383: */ 2384: function allowedChildren() { 2385: $allowedChildren = array(); 2386: $candidates = $this->stat('allowed_children'); 2387: if($candidates && $candidates != "none" && $candidates != "SiteTree_root") { * 2388: foreach($candidates as $candidate) { 2389: // If a classname is prefixed by "*", such as "*Page", then only that 2390: // class is allowed - no subclasses. Otherwise, the class and all its subclasses are allowed. 2391: if(substr($candidate,0,1) == '*') { 2392: $allowedChildren[] = substr($candidate,1); 2393: } else { 2394: $subclasses = ClassInfo::subclassesFor($candidate); Trace ===== SiteTree->allowedChildren() CMSMain.php:364 CMSMain->SiteTreeHints() ViewableData.php:366 ViewableData->obj(SiteTreeHints,,,1) ViewableData.php:443 ViewableData->XML_val(SiteTreeHints,,1) call_user_func_array(Array,Array) SSViewer.php:130 SSViewer_Scope->__call(XML_val,Array) SSViewer.php:461 SSViewer_DataPresenter->__call(XML_val,Array) .cache.cms.templates.Includes.CMSMain_TreeView.ss:78 SSViewer_DataPresenter->XML_val(SiteTreeHints,,1) .cache.cms.templates.Includes.CMSMain_TreeView.ss:78 include(/tmp/silverstripe-cache-home-besstel-public_html-itela.org/.cache.cms.templates.Includes.CMSMain_TreeView.ss) SSViewer.php:778 SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-home-besstel-public_html-itela.org/.cache.cms.templates.Includes.CMSMain_TreeView.ss,CMSPagesController,,Array) SSViewer.php:844 SSViewer->process(CMSPagesController,) ViewableData.php:335 ViewableData->renderWith(Array) CMSMain.php:647 CMSMain->treeview(SS_HTTPRequest) Controller.php:195 Controller->handleAction(SS_HTTPRequest) RequestHandler.php:168 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) Controller.php:149 Controller->handleRequest(SS_HTTPRequest,DataModel) LeftAndMain.php:336 LeftAndMain->handleRequest(SS_HTTPRequest,DataModel) AdminRootController.php:88 AdminRootController->handleRequest(SS_HTTPRequest,DataModel) Director.php:281 Director::handleRequest(SS_HTTPRequest,Session,DataModel) Director.php:112 Director::direct(admin/pages/treeview,DataModel) main.php:126 require_once(/home/website/public_html/itela.org/framework/main.php) index.php:63