diff --git a/app/Story/DefaultBooksStory.php b/app/Story/DefaultBooksStory.php index 3362fc27..e733d06f 100644 --- a/app/Story/DefaultBooksStory.php +++ b/app/Story/DefaultBooksStory.php @@ -23,6 +23,13 @@ public function build(): void BookFactory::new() ->withTitle('1984') ->withAuthorName('George Orwell') + ->create() + ; + + BookFactory::new() + ->withTitle('Lord of the Flies') + ->withAuthorName('William Golding') + ->create() ; BookFactory::createMany(20); diff --git a/docs/.gitbook/assets/show_book_title.png b/docs/.gitbook/assets/show_book_title.png new file mode 100644 index 00000000..3ea43fcd Binary files /dev/null and b/docs/.gitbook/assets/show_book_title.png differ diff --git a/docs/cookbook/admin_panel/page_titles.md b/docs/cookbook/admin_panel/page_titles.md index c9e9faf3..91630937 100644 --- a/docs/cookbook/admin_panel/page_titles.md +++ b/docs/cookbook/admin_panel/page_titles.md @@ -28,13 +28,36 @@ We're going to reuse this hook and its template in our config file and add a `he sylius_twig_hooks: hooks: # ... - 'sylius_admin.speaker.index.content.header.title_block': + 'sylius_admin.speaker.index.content.header.title_block': # The speaker index title block title: template: '@SyliusBootstrapAdminUi/shared/crud/common/content/header/title_block/title.html.twig' configuration: title: app.ui.browsing_speakers # here is our title override ``` +
+ +
Show book title
+ +
+ +Note that you can also use [Symfony Expression Language](https://symfony.com/doc/current/components/expression_language.html) in the configuration key for dynamic titles: + +```yaml +# config/packages/sylius_bootstrap_admin_ui.yaml +# ... +sylius_twig_hooks: + hooks: + # ... + 'sylius_admin.book.show.content.header.title_block': # The show page title block + title: + template: '@SyliusBootstrapAdminUi/shared/crud/common/content/header/title_block/title.html.twig' + configuration: + title: '@=_context.book.getTitle()' # Use the current book title +``` + +`@=_context` contains all the current Twig vars. + ## Adding an icon