getComponent() public method

Returns component specified by name or path.
public getComponent ( $name, $need = TRUE ) : Nette\ComponentModel\IComponent | null
return Nette\ComponentModel\IComponent | null
Exemplo n.º 1
0
 /**
  * Returns component specified by name or path.
  *
  * @param  string
  * @param  bool   throw exception if component doesn't exist?
  * @return IComponent|NULL
  */
 public function getComponent($name, $need = TRUE)
 {
     $origName = $name;
     if (($pos = strpos($name, self::NAME_SEPARATOR)) !== FALSE) {
         $name = substr($name, 0, $pos);
     }
     if (array_search($name, $this->registered) === FALSE && $this->widgetList->exists($name)) {
         $this->registered[] = $name;
         $this->addComponent($this->widgetList->get($name), $name);
     }
     return parent::getComponent($origName, $need);
 }