Feature request: new method Link::isLinkCurrent()
MartkCz opened this issue · comments
MartkCz commented
I want check lazy link if is current, but I can't because of private $component
class TabsComponent {
public function addLink(string $name, Link $link)
}
Solution is:
class Link {
public function getComponent(): Component
}
or better
class Link {
public function isLinkCurrent(): bool {
return $this->component->isLinkCurrent($this->destination, $this->parameters);
}
}
I'm willing to write a PR
Marek Bartoš commented
$tabsComponent->isLinkCurrent($link->getDestination(), $link->getParameters())
would not work?
MartkCz commented
It doesn't work, when link is from presenter I must call $this->getPresenter()
when from other component, I have to call $this['component']->isLinkCurrent()
, but I don't know from which component link is created, because of private property $component
Code:
$this->lazyLink('this', ['type' => 'groups'])