diff --git a/importmap.php b/importmap.php index 3b49af09..ea1cce89 100644 --- a/importmap.php +++ b/importmap.php @@ -45,4 +45,12 @@ '@symfony/ux-live-component' => [ 'path' => './vendor/symfony/ux-live-component/assets/dist/live_controller.js', ], + 'tom-select/dist/css/tom-select.bootstrap4.css' => [ + 'version' => '2.4.3', + 'type' => 'css', + ], + 'tom-select/dist/css/tom-select.bootstrap5.css' => [ + 'version' => '2.4.3', + 'type' => 'css', + ], ]; diff --git a/src/AdminUi/config/services.php b/src/AdminUi/config/services.php index e86bdba2..3e5a8f33 100644 --- a/src/AdminUi/config/services.php +++ b/src/AdminUi/config/services.php @@ -13,6 +13,8 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; +use Sylius\AdminUi\Context\Context; +use Sylius\AdminUi\Context\RoutingContext; use Sylius\AdminUi\Knp\Menu\MenuBuilder; use Sylius\AdminUi\Knp\Menu\MenuBuilderInterface; use Sylius\AdminUi\TwigHooks\Hookable\Metadata\RoutingHookableMetadataFactory; @@ -35,4 +37,16 @@ param('sylius_admin_ui.routing'), ]) ; + + $services->set('sylius_admin_ui.routing_context', RoutingContext::class) + ->args([ + param('sylius_admin_ui.routing'), + ]) + ; + + $services->set('sylius_admin_ui.context', Context::class) + ->args([ + service('sylius_admin_ui.routing_context'), + ]) + ; }; diff --git a/src/AdminUi/config/services/twig/extension.php b/src/AdminUi/config/services/twig/extension.php index d5a01d63..2b2aa797 100644 --- a/src/AdminUi/config/services/twig/extension.php +++ b/src/AdminUi/config/services/twig/extension.php @@ -13,6 +13,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; +use Sylius\AdminUi\Twig\Extension\ContextExtension; use Sylius\AdminUi\Twig\Extension\RedirectPathExtension; return function (ContainerConfigurator $configurator): void { @@ -25,4 +26,11 @@ ]) ->tag(name: 'twig.extension') ; + + $services->set('sylius_admin_ui.twig.extension.context', ContextExtension::class) + ->args([ + service('sylius_admin_ui.context'), + ]) + ->tag(name: 'twig.extension') + ; }; diff --git a/src/AdminUi/src/Context/Context.php b/src/AdminUi/src/Context/Context.php new file mode 100644 index 00000000..38c72da7 --- /dev/null +++ b/src/AdminUi/src/Context/Context.php @@ -0,0 +1,27 @@ +routing; + } +} diff --git a/src/AdminUi/src/Context/RoutingContext.php b/src/AdminUi/src/Context/RoutingContext.php new file mode 100644 index 00000000..fdfb1022 --- /dev/null +++ b/src/AdminUi/src/Context/RoutingContext.php @@ -0,0 +1,27 @@ +routing['dashboard_path'] ?? '/admin'; + } +} diff --git a/src/AdminUi/src/Twig/Extension/ContextExtension.php b/src/AdminUi/src/Twig/Extension/ContextExtension.php new file mode 100644 index 00000000..147c4812 --- /dev/null +++ b/src/AdminUi/src/Twig/Extension/ContextExtension.php @@ -0,0 +1,33 @@ + $this->context, + ]; + } +} diff --git a/src/BootstrapAdminUi/templates/shared/crud/common/sidebar/logo.html.twig b/src/BootstrapAdminUi/templates/shared/crud/common/sidebar/logo.html.twig index 2fb171b2..dd08a084 100644 --- a/src/BootstrapAdminUi/templates/shared/crud/common/sidebar/logo.html.twig +++ b/src/BootstrapAdminUi/templates/shared/crud/common/sidebar/logo.html.twig @@ -1,4 +1,4 @@ -{% set dashboard_path = hookable_metadata.context.routing.dashboard_path|default('/admin') %} +{% set dashboard_path = sylius_admin_ui_context.routing.dashboardPath %}

diff --git a/src/BootstrapAdminUi/templates/shared/crud/create/content/header/breadcrumbs.html.twig b/src/BootstrapAdminUi/templates/shared/crud/create/content/header/breadcrumbs.html.twig index 21372dcc..bcf3e69b 100644 --- a/src/BootstrapAdminUi/templates/shared/crud/create/content/header/breadcrumbs.html.twig +++ b/src/BootstrapAdminUi/templates/shared/crud/create/content/header/breadcrumbs.html.twig @@ -14,7 +14,7 @@ ) %} -{% set dashboard_path = hookable_metadata.context.routing.dashboard_path|default('/admin') %} +{% set dashboard_path = sylius_admin_ui_context.routing.dashboardPath %} {{ breadcrumbs([ { name: 'sylius.ui.dashboard', url: dashboard_path, active: false }, diff --git a/src/BootstrapAdminUi/templates/shared/crud/index/content/header/breadcrumbs.html.twig b/src/BootstrapAdminUi/templates/shared/crud/index/content/header/breadcrumbs.html.twig index dc15931b..d827252e 100644 --- a/src/BootstrapAdminUi/templates/shared/crud/index/content/header/breadcrumbs.html.twig +++ b/src/BootstrapAdminUi/templates/shared/crud/index/content/header/breadcrumbs.html.twig @@ -9,7 +9,7 @@ {% set title = hookable_metadata.configuration.title %} {% endif %} -{% set dashboard_path = hookable_metadata.context.routing.dashboard_path|default('/admin') %} +{% set dashboard_path = sylius_admin_ui_context.routing.dashboardPath %} {{ breadcrumbs([ { 'name': 'sylius.ui.dashboard', 'url': dashboard_path, 'active': false }, diff --git a/src/BootstrapAdminUi/templates/shared/crud/show/content/header/breadcrumbs.html.twig b/src/BootstrapAdminUi/templates/shared/crud/show/content/header/breadcrumbs.html.twig index 9b5a8d68..4e5690ed 100644 --- a/src/BootstrapAdminUi/templates/shared/crud/show/content/header/breadcrumbs.html.twig +++ b/src/BootstrapAdminUi/templates/shared/crud/show/content/header/breadcrumbs.html.twig @@ -28,7 +28,7 @@ {% set resource_show = { name: resource_show_name, active: true} %} {% endif %} -{% set dashboard_path = hookable_metadata.context.routing.dashboard_path|default('/admin') %} +{% set dashboard_path = sylius_admin_ui_context.routing.dashboardPath %} {{ breadcrumbs([ { name: 'sylius.ui.dashboard', url: dashboard_path, active: false }, diff --git a/src/BootstrapAdminUi/templates/shared/crud/update/content/header/breadcrumbs.html.twig b/src/BootstrapAdminUi/templates/shared/crud/update/content/header/breadcrumbs.html.twig index e05fa6eb..62977656 100644 --- a/src/BootstrapAdminUi/templates/shared/crud/update/content/header/breadcrumbs.html.twig +++ b/src/BootstrapAdminUi/templates/shared/crud/update/content/header/breadcrumbs.html.twig @@ -24,7 +24,7 @@ {% set resource_edit = { name: resource_edit_name, active: true} %} {% endif %} -{% set dashboard_path = hookable_metadata.context.routing.dashboard_path|default('/admin') %} +{% set dashboard_path = sylius_admin_ui_context.routing.dashboardPath %} {{ breadcrumbs([ { name: 'sylius.ui.dashboard', url: dashboard_path, active: false }, diff --git a/symfony.lock b/symfony.lock index 5ecd19b4..d2e787fa 100644 --- a/symfony.lock +++ b/symfony.lock @@ -11,6 +11,15 @@ "ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05" } }, + "doctrine/deprecations": { + "version": "1.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "87424683adc81d7dc305eefec1fced883084aab9" + } + }, "doctrine/doctrine-bundle": { "version": "2.12", "recipe": {