From 24f845cc5b0c5ed4fe2b558bbdc6ad54a65f5794 Mon Sep 17 00:00:00 2001 From: Adam Kadlec Date: Sun, 14 Jan 2018 19:33:45 +0100 Subject: [PATCH] - Refactoring --- src/IPub/Menu/Filters/Status/Filter.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/IPub/Menu/Filters/Status/Filter.php b/src/IPub/Menu/Filters/Status/Filter.php index fbf5579..f6c0c43 100644 --- a/src/IPub/Menu/Filters/Status/Filter.php +++ b/src/IPub/Menu/Filters/Status/Filter.php @@ -14,10 +14,8 @@ namespace IPub\Menu\Filters\Status; -use Nette; use Nette\Application; -use IPub; use IPub\Menu\Entities; use IPub\Menu\Filters; @@ -99,11 +97,20 @@ public function accept() private function checkRule($rule) : bool { try { - // Try to check rule if is possible - return $this->presenter->isLinkCurrent($rule); + if (is_array($rule)) { + $link = $this->presenter->link($rule[0], $rule[1]); + + return $this->presenter->link('this') === $link; + + } else { + // Try to check rule if is possible + return $this->presenter->isLinkCurrent($rule); + } } catch (Application\UI\InvalidLinkException $e) { // Presenter for checked route does not exists } + + return FALSE; } }