Skip to content

[AdminUi] Add a Twig global variable for the context - #281

Closed
loic425 wants to merge 1 commit into
Sylius:mainfrom
loic425:admin-ui-context
Closed

[AdminUi] Add a Twig global variable for the context#281
loic425 wants to merge 1 commit into
Sylius:mainfrom
loic425:admin-ui-context

Conversation

@loic425

@loic425 loic425 commented Sep 24, 2025

Copy link
Copy Markdown
Member

Add a better DX for the admin ui context.

- {% set dashboard_path = hookable_metadata.context.routing.dashboard_path|default('/admin') %}
+ {% set dashboard_path = sylius_admin_ui_context.routing.dashboardPath %}

Then, we have an autocompletion on our IDE.
image

@loic425
loic425 marked this pull request as draft September 24, 2025 13:01
Comment thread composer.json Outdated
@loic425
loic425 marked this pull request as ready for review September 25, 2025 07:31
Comment thread importmap.php
'@symfony/ux-live-component' => [
'path' => './vendor/symfony/ux-live-component/assets/dist/live_controller.js',
],
'tom-select/dist/css/tom-select.bootstrap4.css' => [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need both?

@loic425 loic425 Sep 25, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's automatical now, after the composer install. Here, it's only on the test application.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should both Context and RoutingContext have interfaces? In case I would want to override those classes at end-user projects.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want user to change those contexts for now. That's only to bring access to admin ui configuration.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either interfaces or some other extension point would be great, but yeah, it could be added at a later date.

@loic425 loic425 Sep 25, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but before adding some extension point, it's preferable to be stable on data accessors. I think I need to add login path and things like that before. Or just adding the interface on the main context class.

@loic425

loic425 commented Sep 25, 2025

Copy link
Copy Markdown
Member Author

I really didn't think it through; we can use the routes provided now.
Replaced by #283

@loic425 loic425 closed this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants