Skip to content

Commit 1d25bca

Browse files
committed
Update doc
1 parent 08057ed commit 1d25bca

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

docs/cookbook/admin_panel/menu.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,45 @@ final readonly class MenuBuilder implements MenuBuilderInterface
8888
}
8989
}
9090
```
91+
92+
### Opening a link in a new tab
93+
94+
Target blank directive can be added to link that either are top level menu items without children or children items. In other words this can be configured to item that do not have children.
95+
96+
This can be configured by setting a link attribute on a menu item:
97+
98+
You can make a link open in a new browser tab by adding the `target="_blank"` link attribute to menu items. This can be applied to top-level menu items without children, or to child items themselves. In other words, it only works for items that do not have submenus.
99+
100+
To configure this behavior, set the target link attribute on the menu item as shown below:
101+
102+
```php
103+
// ...
104+
#[AsDecorator(decorates: 'sylius_admin_ui.knp.menu_builder')]
105+
final readonly class MenuBuilder implements MenuBuilderInterface
106+
{
107+
// ...
108+
109+
public function createMenu(array $options): ItemInterface
110+
{
111+
$menu = $this->factory->createItem('root');
112+
// ...
113+
$this->aaddApiDocMenuddApiDocMenu($menu);
114+
115+
return $menu;
116+
}
117+
118+
private function addApiDocMenu(ItemInterface $menu): void
119+
{
120+
$library = $menu
121+
->addChild('api_doc', [
122+
'route' => 'api_doc',
123+
])
124+
->setLabel('app.ui.api_doc')
125+
->setLabelAttribute('icon', 'tabler:api')
126+
->setLinkAttribute('target', '_blank') // Opens the link in a new tab
127+
;
128+
}
129+
}
130+
```
131+
132+
>>>>>>> Stashed changes

docs/cookbook/admin_panel/page_titles.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Customizing the page titles
22

3+
## Defining the application base title
4+
5+
The application’s base title can be configured using the `sylius_admin.base#base_title` Twig hook. Here's an example of how to define it:
6+
7+
{% tabs %}
8+
{% tab title="YAML" %}
9+
{% code title="config/packages/sylius_bootstrap_admin_ui.yaml" lineNumbers="true" %}
10+
```yaml
11+
# ...
12+
sylius_twig_hooks:
13+
hooks:
14+
'sylius_admin.base#base_title':
15+
default:
16+
configuration:
17+
title: My app
18+
```
19+
{% endcode %}
20+
{% endtab %}
21+
22+
323
## Changing the default title for a specific page
424
525
<div data-full-width="false">

0 commit comments

Comments
 (0)