/** * Добавляет компонент в строку-контейнер * переопределяет родительский метод * @param HtmlComponent добавляемый компонент */ public function add(HtmlComponent $component) { if (isset($this->components[$component->id]) || isset($this->components[$component->id . ":" . $this->number])) { // $id = substr($component->id,0,strpos($component->id,':')); // $pid = substr($this->id,0,strpos($this->id,':')); throw new ZE(sprintf(ERROR_DATAROW_COMPONENT_EXISTS, $component->id, $pid)); } $this->components[$component->id] = $component; $component->setOwner($this); return $component; }
/** * Добавляет компонент к списку дочерних * Иерархия компонентов должна строго соответствовать иерархии * вложеных тэгов (с аттрибутами zippy) в HTML шаблоне */ public function add(HtmlComponent $component) { if (isset($this->components[$component->id])) { throw new ZE(sprintf(ERROR_COMPONENT_ALREADY_EXISTS, $component->id, $this->id)); } if (property_exists($this, $component->id)) { $id = strlen($this->id) > 0 ? $this->id : get_class($this); throw new ZE(sprintf(ERROR_COMPONENT_AS_PROPERTY, $component->id, $id)); } $this->components[$component->id] = $component; $component->setOwner($this); $component->onAdded(); return $component; }