diff --git a/docs/.gitbook/assets/custom_title.png b/docs/.gitbook/assets/custom_title.png new file mode 100644 index 00000000..f93a52d2 Binary files /dev/null and b/docs/.gitbook/assets/custom_title.png differ diff --git a/docs/cookbook/admin_panel/menu.md b/docs/cookbook/admin_panel/menu.md index 12c32d21..5107d812 100644 --- a/docs/cookbook/admin_panel/menu.md +++ b/docs/cookbook/admin_panel/menu.md @@ -88,3 +88,41 @@ final readonly class MenuBuilder implements MenuBuilderInterface } } ``` + +### Opening a link in a new tab + +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. + +To configure this behavior, set the target link attribute on the menu item as shown below: + +{% code title="src/Menu/MenuBuilder.php" lineNumbers="true" %} +```php +// ... +#[AsDecorator(decorates: 'sylius_admin_ui.knp.menu_builder')] +final readonly class MenuBuilder implements MenuBuilderInterface +{ + // ... + + public function createMenu(array $options): ItemInterface + { + $menu = $this->factory->createItem('root'); + // ... + $this->addYourWebsitebMenu($menu); + + return $menu; + } + + private function addYourWebsitebMenu(ItemInterface $menu): void + { + $apiDoc = $menu + ->addChild('your_website', [ + 'route' => 'app_homepage', + ]) + ->setLabel('app.ui.your_website') + ->setLabelAttribute('icon', 'tabler:arrow-up-right') + ->setLinkAttribute('target', '_blank') // Opens the link in a new tab + ; + } +} +``` +{% endcode %} diff --git a/docs/cookbook/admin_panel/page_titles.md b/docs/cookbook/admin_panel/page_titles.md index 8f64531a..b0b0556e 100644 --- a/docs/cookbook/admin_panel/page_titles.md +++ b/docs/cookbook/admin_panel/page_titles.md @@ -1,5 +1,55 @@ # Customizing the page titles +## Defining the application base title + +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: + +