Allow open in new tab for side bar links
This commit is contained in:
parent
cd84f1f8a6
commit
5229340412
@ -18,7 +18,8 @@ class Hook
|
||||
* [
|
||||
* 'title' => 'Title', # will be translated by translator
|
||||
* 'link' => 'user/config', # route link
|
||||
* 'icon' => 'fa-book' # font-awesome icon
|
||||
* 'icon' => 'fa-book', # font-awesome icon
|
||||
* 'new-tab' => false, # open the link in new tab or not, false by default
|
||||
* ]
|
||||
* @return void
|
||||
*/
|
||||
|
@ -166,8 +166,9 @@ if (! function_exists('bs_menu')) {
|
||||
} else {
|
||||
if ($value) {
|
||||
$content .= sprintf(
|
||||
'<a href="%s"><i class="%s %s"></i> <span>%s</span></a>',
|
||||
'<a href="%s" %s><i class="%s %s"></i> <span>%s</span></a>',
|
||||
url((string) $value['link']),
|
||||
Arr::get($value, 'new-tab') ? 'target="_blank"' : '',
|
||||
$value['icon'] == 'fa-circle' ? 'far' : 'fas',
|
||||
(string) $value['icon'],
|
||||
trans((string) $value['title'])
|
||||
|
@ -16,11 +16,12 @@ class HookTest extends TestCase
|
||||
'title' => 'Link A',
|
||||
'link' => '/to/a',
|
||||
'icon' => 'fa-book',
|
||||
'new-tab' => true,
|
||||
]);
|
||||
$this->actAs('normal')
|
||||
->get('/user')
|
||||
->assertSee('Link A')
|
||||
->assertSee('/to/a')
|
||||
->assertSee('/to/a" target="_blank"')
|
||||
->assertSee('fa-book');
|
||||
|
||||
// Out of bound
|
||||
|
Loading…
Reference in New Issue
Block a user