Skip to content

Instantly share code, notes, and snippets.

@RaymondBenc
Created September 23, 2015 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RaymondBenc/5b3e03412c7b88560a99 to your computer and use it in GitHub Desktop.
Save RaymondBenc/5b3e03412c7b88560a99 to your computer and use it in GitHub Desktop.
<?php
$block = function(Core\Block $block) {
$is = new Core\Is();
$menus = [
[
'module' => 'pages',
'perm' => 'pages.can_view_browse_pages',
'phrase' => 'Pages or Groups',
'icon' => 'th',
'url' => '/latest/stnpages'
],
[
'module' => 'blog',
'perm' => 'pages.can_view_browse_pages',
'phrase' => 'Blogs',
'icon' => 'pencil-square',
'url' => '/latest/stblogs'
]
];
$html = '<ul>';
foreach ($menus as $menu) {
if ($is->module($menu['module']) && $block->active->perm($menu['perm'])) {
$html .= '<li><a href="' . $block->url->make($menu['url']) . '"><i class="fa fa-' . $menu['icon'] . ' fa-3x fa-border"></i><br />' . _p($menu['phrase']) . '</a></li>';
}
}
$html .= '</ul>';
return $html;
};
$controllers = [
'core.index-member',
'blog.index'
];
foreach ($controllers as $controller) {
new Core\Block($controller, 1, $block);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment