component multi render from which version? {control login-quick} nebo {control login-default}

Notice: This thread is very old.
mcmatak
Member | 504
+
0
-

Do you know from which version works multi render in components?

if u use

{control login-quick}

it calls component login with public function renderQuick()

and

{control login-default}

it calls component login with public function renderDefault()

Filip Procházka
Moderator | 4668
+
0
-

There is nothing like that in nette and never was. This is the only way to do what you want.

protected function createComponentLogin()
{
	return new UI\Multiplier(function ($name) {
		$control = new Something;
		$control->setView($name);
		return $control;
	});
}
class Something extends UI\Control
{
	private $view = 'default';
	public function setView($view) { $this->view = $view; }
	public function render()
	{
		call_user_func_array(array($this, 'render' . $this->view), func_get_args());
	}
}

Or, you can use the standard way that is in Nette like forever

{control login:quick}

which will translate in template to

$presenter['login']->renderQuick();