/** * Overridden to load all children from Matrix. For now we're ignoring * the $showAll param - we have a separate 'dependentChildren' method * to specifically handle dependent and non-dependent children * * @param boolean $showAll * @return ArrayList */ public function stageChildren($showAll = false) { if (!$this->ID) { return MatrixContentSource::get(); } if (!$this->objChildren) { $this->objChildren = new ArrayList(); // For the first batch, just get all the immediate children of the // top level $repo = $this->source->getRemoteRepository(); if ($repo->isConnected()) { if (isset($_GET['debug_profile'])) { Profiler::mark("MatrixContentItem", "getChildren"); } if (!isset($this->remoteProperties['id'])) { // for some reason the call failed! return $this->objChildren; } $childItems = $repo->getChildren(array('id' => $this->remoteProperties['id'], 'depth' => 1)); if (isset($_GET['debug_profile'])) { Profiler::unmark("MatrixContentItem", "getChildren"); } // make sure that there's no errors!! if (!isset($childItems->error)) { if (isset($_GET['debug_profile'])) { Profiler::mark("MatrixContentItem", "loadChildren"); } // means there weren't any children of this asset foreach ($childItems as $childId => $properties) { $item = $this->source->getObject($properties->id); if (isset($properties->LinkType)) { $item->ShowInMenus = true; } $this->objChildren->push($item); } if (isset($_GET['debug_profile'])) { Profiler::unmark("MatrixContentItem", "loadChildren"); } } } } return $this->objChildren; }
/** * Override to fool hierarchy.php * * @param boolean $showAll * @return ArrayList */ public function stageChildren($showAll = false) { // if we don't have an ID directly, we should load and return ALL the external content sources if (!$this->ID) { return MatrixContentSource::get(); } $children = new ArrayList(); try { if ($this->ApiUrl && $this->RootAsset) { $repo = $this->getRemoteRepository(); if ($repo->isConnected()) { $item = $this->getRoot(); if ($item) { $children = $item->stageChildren(); } } } } catch (Exception $e) { singleton('ECUtils')->log(__CLASS__ . ':' . __LINE__ . ':: ' . $e->getMessage()); } return $children; }