Exemplo n.º 1
0
 /**
  * @param string $name
  * @return IComponent
  */
 protected function createComponent($name)
 {
     $component = parent::createComponent($name);
     if ($component instanceof \Nette\Forms\Form) {
         $component->setTranslator($this->translator);
     }
     return $component;
 }
 protected function createComponent($name)
 {
     if (isset($this->controlFactories[$name])) {
         $controlFactory = $this->controlFactories[$name];
         return $controlFactory->create();
     }
     return parent::createComponent($name);
 }
Exemplo n.º 3
0
 /**
  * @param string
  * @return \Nette\ComponentModel\IComponent
  */
 protected function createComponent($name)
 {
     $method = 'createComponent' . ucfirst($name);
     if (method_exists($this, $method)) {
         $this->checkRequirements($this->getReflection()->getMethod($method));
     }
     return parent::createComponent($name);
 }
Exemplo n.º 4
0
 /**
  * Component factory. Delegates the creation of components to a createComponent<Name> method.
  *
  * @param  string      component name
  * @return IComponent  the created component (optionally)
  */
 protected function createComponent($name)
 {
     // parent
     if (($control = parent::createComponent($name)) == TRUE) {
         return $control;
     }
     // widget from widgetManager
     if ($this->presenter->widgetManager->hasWidget($name)) {
         return $this->presenter->widgetManager->getWidget($name)->invoke();
     }
     throw new \Nette\InvalidArgumentException("Component or widget with name '{$name}' does not exist.");
 }
Exemplo n.º 5
0
	/**
	 * Component factory. Delegates the creation of components to a createComponent<Name> method.
	 * @param  string
	 * @return \Nette\ComponentModel\IComponent
	 */
	protected function createComponent($name)
	{
		$container = $this->getContext()->components;
		if ($container->hasComponent($name)) {
			return $container->getComponent($name, $this);
		}

		return parent::createComponent($name);
	}
Exemplo n.º 6
0
 /**
  * @param string $name
  * @return \Nette\ComponentModel\IComponent
  */
 protected function createComponent($name)
 {
     $this->load();
     return parent::createComponent($name);
 }
Exemplo n.º 7
0
 protected function createComponent($name) : Nette\ComponentModel\IComponent
 {
     return parent::createComponent($name) ?: $this->getPresenter()->createComponent($name);
 }
Exemplo n.º 8
0
 /**
  * Creates Component
  *
  * priority: props, $this->componentFactory(), createComponent<Name> methods
  * @param  string      component name
  * @return IComponent  the created component (optionally)
  */
 protected final function createComponent($name)
 {
     if ($this->props->hasProp('onComponentCreate')) {
         $component = $this->props->onComponentCreate($this, $name);
         if ($component) {
             return $component;
         }
     }
     $component = $this->onComponentCreate($this, $name);
     if ($component) {
         return $component;
     }
     $component = parent::createComponent($name);
     if ($component) {
         return $component;
     }
     //stub control
     $props = new Props();
     $props->templatePath = __DIR__ . '/templates/no-control.latte';
     /*$props->onRender = function (RaControl $control) {
           if ($control->getParent() instanceOf StubControl) {
               $control->getParent()->render();
               return false;
           }
           return true; //continue rendering
       };*/
     return new StubControl($props);
 }
Exemplo n.º 9
0
 protected function createComponent($name)
 {
     $control = parent::createComponent($name);
     $this->prepareComponent($name, $control);
     return $control;
 }