Is {ifCurrent} going to be removed?

netteman
Member | 92
+
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/macros#…
https://latte.nette.org/en/macros#…

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 | 463
+
0
-

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

netteman
Member | 92
+
+1
-

Nooooooooo! :(

romal
Member | 9
+
0
-

netteman wrote:

Nooooooooo! :(

Use it! It is still works fine!

David Grudl
Nette Core | 7189
+
+2
-

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

romal
Member | 9
+
0
-

David Grudl wrote:

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

Thanks, David!!!

ppar
Backer | 339
+
0
-

@DavidGrudl Why did you decided deprecated it?

David Grudl
Nette Core | 7189
+
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>