nette/application

introduce isModuleCurrent method

Closed this issue · 1 comments

Is your feature request related to a problem?

  • I can use $presenter->isLinkCurrent('MyModule:MyPresenter:*')
  • using $presenter->isLinkCurrent('MyModule:*') throws exception

I guess that many had tried to use the analogy for modules - but $presenter->isLinkCurrent('MyModule:*') throws InvalidLinkException. That looks correct to me after thinking for a while - trying to link module (not a presenter from the module) is meaningless.

Anyway I believe there should be a way how to determine the same for modules - can be handy in navigation etc.

Explain your intentions.
Provide a default solution for simple determination that I'm linking from current application module.

It's up to you to make a strong case to convince the project's developers of the merits of this feature.
When framework encourages use of modules, it can be confusing (newcomers included) that one can link to a submodule, can determine linking to current presenter but get an error when using similar notation for modules.

When looking for solution, I found two (first, second) really old related posts in forum.

Anyone can come up with his own solution so when this request is considered inappropriate, I would at least make a remark in documentation (maybe here) that it cannot be used in this way.

dg commented

'MyModule:*' simply means „any action in presenter named MyModule“. It would have to be written like isLinkCurrent('MyModule:*:*') or maybe isLinkCurrent('MyModule:*:'), which is not nice.

So I prefer to create a new method, either isModuleCurrent() or more universal $presenter->getModule().