/** * Initializes a new content branch * @param mixed $item The content tree item */ function __construct($item) { $this->item = $item; $this->tree = $this->TreeProvider(); $this->child = $this->tree->FirstChildOf($this->item); $this->content = $this->tree->ContentByItem($this->item); $this->module = ClassFinder::CreateFrontendModule($this->content->GetType()); $this->module->SetTreeItem($this->tree, $this->item); }
/** * Inserts the item * @param mixed $item * @param mixed $parent * @param mixed $previous */ function Insert($item, $parent = null, $previous = null) { if ($previous) { $parent = $this->provider->ParentOf($previous); } $oldNext = $this->provider->NextOf($item); $oldPrev = $this->provider->PreviousOf($item); $oldFirst = $this->provider->FirstChildOf($parent); if (!($oldPrev && $previous && $this->provider->Equals($oldPrev, $previous))) { $this->CloseCutGap($oldPrev, $oldNext, $item); } $this->UpdateInsertItem($item, $parent, $previous); if (!$previous) { $this->AssureFirstChild($item, $oldFirst); } }