-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add DataFilter & update menuitem partials * add DataFilter in default config * update README.md for menu item data * fix CI * add test case * fix cs * Update DataFilter.php * Update DataFilter.php Co-authored-by: Florian Ressel <florian@genxtreme.de>
- Loading branch information
1 parent
180633b
commit 75a48e4
Showing
8 changed files
with
87 additions
and
15 deletions.
There are no files selected for viewing
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
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
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
31 changes: 16 additions & 15 deletions
31
resources/views/partials/menuitems/menu-item-top-nav.blade.php
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace JeroenNoten\LaravelAdminLte\Menu\Filters; | ||
|
||
use JeroenNoten\LaravelAdminLte\Menu\Builder; | ||
|
||
class DataFilter implements FilterInterface | ||
{ | ||
public function transform($item, Builder $builder) | ||
{ | ||
if (isset($item['data']) && is_array($item['data'])) { | ||
$item['data-compiled'] = $this->compileData($item['data']); | ||
} | ||
|
||
return $item; | ||
} | ||
|
||
protected function compileData($dataArray) | ||
{ | ||
$compiled = []; | ||
|
||
foreach ($dataArray as $key => $value) { | ||
$compiled[] = 'data-'.$key.'="'.$value.'"'; | ||
} | ||
|
||
return implode(' ', $compiled); | ||
} | ||
} |
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
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