/** * @param $name * @param ComponentInterface $component * @param int|string $position * @return ComponentInterface * @throws FormException */ protected function adopt($name, ComponentInterface $component, $position = -1) { // add using parent method $component = parent::adopt($name, $component, $position); // add a type css class if ($component instanceof CssComponentInterface) { $component->setCssTypeClass($name); } // set the name as type if ($component instanceof TypedComponentInterface) { $component->setComponentType($name); } // also set the css type class return $component; }
/** * */ public function __clone() { // cannot clone a container when it is already used in a form runtime if (!is_null($this->state)) { throw new FormException(sprintf("Cannot clone component during form processing: '%s'", $this->getId())); } // call parent clone to clone all children parent::__clone(); // clear adoption history $this->adoptionHistory = null; // clear any runtime errors $this->errors = array(); // unset the current context $this->context = null; }