Is {ifCurrent} going to be removed?

netteman
Member | 125
+
0
-

Hi,

I'm using the {ifCurrent} macro in my templates because it's super easy to use.

But it's marked as deprecated :(

https://latte.nette.org/cs/tags#…
https://latte.nette.org/en/tags#…

Could you tell me if it's going to be removed in the upcomming Nette 3.0 (and I'll have to switch to the really-difficult-to-write $presenter->isLinkCurrent($link) ? …)

Thanks :)

Ondřej Kubíček
Member | 494
+
0
-

yes, you have to use $presenter->isLinkCurrent($link)

netteman
Member | 125
+
+2
-

Nooooooooo! :(

romal
Member | 16
+
0
-

netteman wrote:

Nooooooooo! :(

Use it! It is still works fine!

David Grudl
Nette Core | 8227
+
+2
-

It's been deprecated for a long time, but it will work in future.

romal
Member | 16
+
0
-

David Grudl wrote:

It's been deprecated for a long time, but it will work in future.

Thanks, David!!!

Petr Parolek
Member | 455
+
0
-

@DavidGrudl Why did you decided deprecated it?

David Grudl
Nette Core | 8227
+
0
-

Because $presenter->isLinkCurrent($link) is more universal:

<li n:class="$presenter->isLinkCurrent('Product:show') && $otherCondition ? active : in-active">
	<a n:href="Product:show">...</a>
</li>

When it is used inside element A, it is not necessary to repeat link destination:

<a n:class="$presenter->isLinkCurrent() ? active : normal" n:href="Product:show">...</a>

Latte 2.6 comes with custom functions, so it will be even easier:

<a n:class="isLinkCurrent() ? active : normal" n:href="Product:show">...</a>