Generating links to a presenter from component

TerryTibbs
Member | 7
+
0
-

Hi,

I have created a basic component and I want to generate links to various presenters, but obviously $link1 = $this->link('Test:hello'); won't work, so how do I do it?

class TestControl extends Control
{
    public function render(): void
    {
		// How do I create a link to the presenter below etc?
		// $link1 = Test:hello ???
		// $link2 = Home:default ???

		$this->template->link1 = $link1;
		$this->template->link2 = $link2;
        $this->template->render(__DIR__ . '/test.latte');
    }
}

An example presenter to link to:

final class TestPresenter extends BasePresenter
{
    public function renderHello(): void
    {}
}

Thanks in advance

TerryTibbs
Member | 7
+
0
-

Infanticide0 wrote:

Hello,

https://doc.nette.org/…eating-links#…

Thanks, I am sure I tried $this->getPresenter()->link('Home:default') and an error popped up, but it's working now?? Oh well, the joys of programming :D

Thanks