Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: new method Link::isLinkCurrent() #229

Closed
MartkCz opened this issue Sep 4, 2019 · 2 comments
Closed

Feature request: new method Link::isLinkCurrent() #229

MartkCz opened this issue Sep 4, 2019 · 2 comments

Comments

@MartkCz
Copy link
Contributor

MartkCz commented Sep 4, 2019

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

@mabar
Copy link
Contributor

mabar commented Sep 18, 2019

$tabsComponent->isLinkCurrent($link->getDestination(), $link->getParameters()) would not work?

@MartkCz
Copy link
Contributor Author

MartkCz commented Sep 18, 2019

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'])

@dg dg closed this as completed in 2f7e73d Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants