Skip to content

Commit

Permalink
fix(menu-builder): Implode classes array into string (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-sheppard authored Feb 16, 2021
1 parent 51bee07 commit db211fc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ protected function filter($menu = [])
_wp_menu_item_classes_by_context($menu);

return array_map(function ($item) {
$item->classes = array_filter($item->classes, function ($class) {
$classes = array_filter($item->classes, function ($class) {
return array_key_exists(
$class,
array_flip($this->classes)
);
});

$item->classes = is_array($classes) ? implode(' ', $classes) : $classes;

foreach ($item as $key => $value) {
if (empty($value)) {
$item->{$key} = false;
Expand Down

0 comments on commit db211fc

Please sign in to comment.