Last active
July 15, 2020 18:39
-
-
Save sksaju/402299874db36c977eb503b271878943 to your computer and use it in GitHub Desktop.
Tutor dashboard menu items
This file contains 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
<ul class="tutor-dashboard-permalinks"> | |
<?php | |
$dashboard_pages = tutils()->tutor_dashboard_nav_ui_items(); | |
foreach ($dashboard_pages as $dashboard_key => $dashboard_page) { | |
$menu_title = $dashboard_page; | |
$menu_link = tutils()->get_tutor_dashboard_page_permalink($dashboard_key); | |
$separator = false; | |
if (is_array($dashboard_page)){ | |
$menu_title = tutils()->array_get('title', $dashboard_page); | |
//Add new menu item property "url" for custom link | |
if (isset($dashboard_page['url'])) { | |
$menu_link = $dashboard_page['url']; | |
} | |
if (isset($dashboard_page['type']) && $dashboard_page['type'] == 'separator') { | |
$separator = true; | |
} | |
} | |
if ($separator) { | |
echo '<li class="tutor-dashboard-menu-divider"></li>'; | |
if ($menu_title) { | |
echo "<li class='tutor-dashboard-menu-divider-header'>{$menu_title}</li>"; | |
} | |
} else { | |
$li_class = "tutor-dashboard-menu-{$dashboard_key}"; | |
if ($dashboard_key === 'index') | |
$dashboard_key = ''; | |
$active_class = $dashboard_key == $dashboard_page_slug ? 'active' : ''; | |
echo "<li class='{$li_class} {$active_class}'><a href='".$menu_link."'> {$menu_title} </a> </li>"; | |
} | |
} | |
?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment