Created
February 6, 2017 13:55
-
-
Save endihunter/aa2c4ebb9060804385a3558bbd1917c0 to your computer and use it in GitHub Desktop.
patch a navigation middleware, activate module navigation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f0f3fe15becb32c85613728c67694b9a0bc91a82 Mon Sep 17 00:00:00 2001 | |
From: Endi <[email protected]> | |
Date: Mon, 6 Feb 2017 15:52:01 +0200 | |
Subject: [PATCH] Set default active status | |
--- | |
src/Middleware/Resources.php | 9 ++++++++- | |
1 file changed, 8 insertions(+), 1 deletion(-) | |
diff --git a/src/Middleware/Resources.php b/src/Middleware/Resources.php | |
index 102e985..e80cbcf 100644 | |
--- a/src/Middleware/Resources.php | |
+++ b/src/Middleware/Resources.php | |
@@ -113,7 +113,14 @@ class Resources | |
$module->title(), | |
['module' => $module->url()], | |
$order, | |
- $module->linkAttributes() | |
+ array_merge( | |
+ $module->linkAttributes(), | |
+ [ | |
+ 'active' => function () use ($module) { | |
+ return starts_with(\URL::getRequest()->getPathInfo(), "/admin/{$module}"); | |
+ }, | |
+ ] | |
+ ) | |
); | |
} else { | |
$navigation->url( | |
-- | |
2.9.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment