-
Notifications
You must be signed in to change notification settings - Fork 16
Update doc #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Update doc #258
Conversation
docs/cookbook/admin_panel/menu.md
Outdated
|
||
### Opening a link in a new tab | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. | |
Target blank directive can be added to links that either are top-level menu items without children or children items. In other words, this can be configured to items that do not have children. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this sentence is redundant with the next one on line 98 - I think we should delete this one entirely up to line 96 and only keep the line 98 one which is much better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the doc like @stlgaits suggested
docs/cookbook/admin_panel/menu.md
Outdated
{ | ||
$menu = $this->factory->createItem('root'); | ||
// ... | ||
$this->aaddApiDocMenuddApiDocMenu($menu); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->aaddApiDocMenuddApiDocMenu($menu); | |
$this->addApiDocMenu($menu); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we're to follow existing examples, this should be named submenu instead.
$this->aaddApiDocMenuddApiDocMenu($menu); | |
$this->addApiDocSubMenu($menu); |
docs/cookbook/admin_panel/menu.md
Outdated
private function addApiDocMenu(ItemInterface $menu): void | ||
{ | ||
$library = $menu | ||
->addChild('api_doc', [ | ||
'route' => 'api_doc', | ||
]) | ||
->setLabel('app.ui.api_doc') | ||
->setLabelAttribute('icon', 'tabler:api') | ||
->setLinkAttribute('target', '_blank') // Opens the link in a new tab | ||
; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private function addApiDocMenu(ItemInterface $menu): void | |
{ | |
$library = $menu | |
->addChild('api_doc', [ | |
'route' => 'api_doc', | |
]) | |
->setLabel('app.ui.api_doc') | |
->setLabelAttribute('icon', 'tabler:api') | |
->setLinkAttribute('target', '_blank') // Opens the link in a new tab | |
; | |
} | |
private function addApiDocSubMenu(ItemInterface $menu): void | |
{ | |
$apiDoc = $menu | |
->addChild('api_doc', [ | |
'route' => 'api_doc', | |
]) | |
->setLabel('app.ui.api_doc') | |
->setLabelAttribute('icon', 'tabler:api') | |
->setLinkAttribute('target', '_blank') // Opens the link in a new tab | |
; | |
} |
docs/cookbook/admin_panel/menu.md
Outdated
} | ||
``` | ||
|
||
>>>>>>> Stashed changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>>>>>> Stashed changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
{% tabs %} | ||
{% tab title="YAML" %} | ||
{% code title="config/packages/sylius_bootstrap_admin_ui.yaml" lineNumbers="true" %} | ||
```yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be cool to have php example as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, and maybe a small screeenshot of the browser tab as well to make it extra explicit?
{% endcode %} | ||
{% endtab %} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/cookbook/admin_panel/menu.md
Outdated
return $menu; | ||
} | ||
|
||
private function addApiDocMenu(ItemInterface $menu): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point to try to remain in userland - possibly an external link to the bookstore's website / blog or to something related to the books ecosystem like Goodreads new releases for instance (e.g. https://www.goodreads.com/book/popular_by_date/2025/5?ref=nav_brws_newrels) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to a link to the website homepage. This is not in the test app, but we've got something similar in Sylius/Sylius
{% tabs %} | ||
{% tab title="YAML" %} | ||
{% code title="config/packages/sylius_bootstrap_admin_ui.yaml" lineNumbers="true" %} | ||
```yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, and maybe a small screeenshot of the browser tab as well to make it extra explicit?
docs/cookbook/admin_panel/menu.md
Outdated
|
||
### Opening a link in a new tab | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this sentence is redundant with the next one on line 98 - I think we should delete this one entirely up to line 96 and only keep the line 98 one which is much better.
docs/cookbook/admin_panel/menu.md
Outdated
|
||
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. | ||
|
||
This can be configured by setting a link attribute on a menu item: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be configured by setting a link attribute on a menu item: |
docs/cookbook/admin_panel/menu.md
Outdated
|
||
### Opening a link in a new tab | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% code title="src/Menu/MenuBuilder.php" lineNumbers="true" %} |
docs/cookbook/admin_panel/menu.md
Outdated
} | ||
} | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% endcode %} | |
docs/cookbook/admin_panel/menu.md
Outdated
return $menu; | ||
} | ||
|
||
private function addApiDocMenu(ItemInterface $menu): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point to try to remain in userland - possibly an external link to the bookstore's website / blog or to something related to the books ecosystem like Goodreads new releases for instance (e.g. https://www.goodreads.com/book/popular_by_date/2025/5?ref=nav_brws_newrels) ?
This PR is a follow-up to these comments: