Exemplo n.º 1
0
 /**
  * @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;
 }
Exemplo n.º 2
0
 /**
  * @param $name
  * @param ComponentInterface $component
  * @param int|string $position
  * @return ComponentInterface
  * @throws FormException
  */
 protected function adopt($name, ComponentInterface $component, $position = self::POSITION_END)
 {
     // add using parent method
     $component = parent::adopt($name, $component, $position);
     // also add a css class for the instance name
     if ($component instanceof CssComponentInterface) {
         $component->addCssClass($name);
     }
     // add component to adoption history
     if (is_array($this->adoptionHistory)) {
         $this->adoptionHistory[] = $component;
     }
     // return component
     return $component;
 }