V1: Feature: Support Magewire in the backend#139
V1: Feature: Support Magewire in the backend#139michielgerritsen wants to merge 1 commit intomagewirephp:1.xfrom
Conversation
|
Awesome stuff @michielgerritsen . You mentioned the backend code lives in another repo. Do you mean an |
|
@jissereitsma The backend code lives in this repository: It holds a few things:
So it's not super much, but a bit more than a simple acl.xml file. |
|
I'm currently working on a module in the Magento backend, using Magewire. To load things properly via AJAX, the Livewire controller in the backend module really really needs to be extending upon the admin action, not implementing the interfaces: Those interfaces are meant for the frontend only (as of yet). I'll update things on my side and hope to add a PR to your PR soon. |
|
For those still on v1 of Magewire who need backend support, we’ve created a fork of @michielgerritsen with some changes and an auto patcher, so you don’t have to worry about patches. Check it out here: Credits to @jissereitsma and @michielgerritsen for the original backend patch module. We’re eagerly waiting for v3 to come out 🙂 Thanks @wpoortman for creating the port of Livewire to Magento, such an awesome addition! |
|
He @rbouma, thanks for mentioning that here and awesome you use it also in the backend. I think most credits should just go to @michielgerritsen, he did a great job! |
Last week during the pre-Meet Magento NL Hackathon, I hacked together a proof of concept on getting Magewire to work in the backend of Magento. This PR is the result of that. Next to that, this PR and repository are also required:
The RequireJS adjustments are made as the backend also needs RequireJS support, but the module has a dependency on customer data. It is not required to make it work in the backend, though. Next to that, the form key in the backend is being retrieved differently than in the frontend.
The solution lies mainly in moving configuration from
etc/frontend/di.xmltoetc/di.xml, and frometc/frontend/events.xmltoetc/events.xml. Also, a controller is created in theadminhtmlfolder, but that extends upon the frontend controller without any changes.A big question that popped up during the hackathon was what about security? Magewire relies on the form key, which by accident makes it a little bit secure, but the controller does not have any extra security built in. Also, another thing that should be thought about is ACLs.
I have the code for the backend in a separate repository. It is worth considering whether this is the right approach or whether it should be merged into the main repository.