Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ $layout = $app->layout;
$layout->menuLeft->addItem(['Welcome Page', 'icon' => 'gift'], ['index']);
$layout->menuLeft->addItem(['Layouts', 'icon' => 'object group'], ['layouts']);

$EditGroup = $layout->menuLeft->addGroup(['Edit', 'icon' => 'edit']);
$EditGroup->addItem('Basics', ['edit/basic']);
$editGroup = $layout->menuLeft->addGroup(['Edit', 'icon' => 'edit']);
$editGroup->addItem('Basics', ['edit/basic']);
```

:::{php:attr} menu
Expand Down
6 changes: 4 additions & 2 deletions src/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function addMenu($name)
$name = [$name];
}

$label = $name['title'] ?? $name['text'] ?? $name['name'] ?? $name[0] ?? null;
$label = $name['title'] ?? $name[0] ?? null;

if ($label !== null) {
$subMenu->template->set('label', $label);
Expand Down Expand Up @@ -123,14 +123,16 @@ public function addGroup($name, string $template = 'menugroup.html')
$name = [$name];
}

$title = $name['title'] ?? $name['text'] ?? $name['name'] ?? $name[0] ?? null;
$title = $name['title'] ?? $name[0] ?? null;

if ($title !== null) {
$group->template->set('title', $title);
}

if (isset($name['icon'])) {
Icon::addTo($group, [$name['icon']], ['Icon'])->removeClass('item');
} elseif (isset($name['label'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caveat: It would be better if the items were right-aligned (the icon or the label) - for menu items (see below), they are right aligned, so the label spreads out to the left. If anyone has a hint, how to set classes for that please contribute.

The solution is probably to implement the "menu group item" the same way as "menu item", currently the HTML/CSS for "menu group item" is using CSS/FUI columns, but "menu item" right float positioning.

Copy link
Member

@mvorisek mvorisek Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 93ac62f I have commit debug code to debug/unify this

also IMO Maestro layout should be integrated into parametrized Admin layout

Label::addTo($group, [$name['label']], ['Icon'])->removeClass('item')->addClass('tiny');
Copy link
Member

@mvorisek mvorisek Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for menu item the size is standard (class is unspecified) - ie. the font size is 12 px

for menu group, the size should not be smaller (tiny is 9 px)

related with https://github.com/atk4/ui/pull/1847/files#r1548874861 which should be solved first/instead

}

return $group;
Expand Down