-
Notifications
You must be signed in to change notification settings - Fork 19
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
Decoupled component builder #151
Comments
Adding a UI to this definitely seems like the most low hanging fruit we could go after. We'd need to create a SingleFileComponent plugin instance (DynamicSingleFileComponent) that receives the constant info from some type of "bridge" entity that gets loaded when its dynamic instances are registered. Given the requirements around putting it on the page, a block plugin does make sense so we can start there. It sounds like you have some specific followup ideas re reduct/react too, which is awesome.
Might work better as a followup or related issue? |
What if we just extended the "react_block" module? We get the react/redux for free, its already in contrib, and it is already used for ACF. If we extend that, then we immediately get this functionality in ACF and demo. |
Yeah that's an idea. I was just trying to extract some focus out of this particular issue and perhaps spark up a few new issues to stay organized. |
Its looking more like we'll need to design our own block plugin that uses this paradigm, but instead lets people do this via a simpler method. Really good reference architecture though. I still think we can build a bunch of plugins with PHP constants, but the code is really locked in with using them. If you wanted to build a super-locked down library of components that users could use, this would still be the way to do it. So I suggest we pivot here and do two things.
|
I like it. For option 1, that sounds like an approach we might could use for Lift/Mautic demo stuff. Invisible pixel that tracks views, or passes user behavior to Lift via JS (like starting to fill out a form, or abandoned cart). I got the idea from this. For option 2, that definitely sounds like an extension of react_block. We just create a submodule that provides a UI and a revisionable entity to store the data (css, js, template). Thats part of a broader refactoring that needs to be done over in the module. I'll open an issue there. Maybe we should reach out to Sam? Get his input? He is working on it right now as I type this 😆 |
Yeah, I was thinking something similar. A patch to the react_block with a submodule might have a good chance of getting committed. I don't mind asking @mortenson what he thinks of these ideas. The worst that could happen is no reply and we'll move forward? My misgiving here is wanting to avoid misusing any api, or forking this into a monster asset injector that we're stuck maintaining on an island in DF. SO I totally agree we should look at the contrib that's already doing stuff like this and try to add to it. |
|
Indeed, the sandbox can change. We're not naive to that! There was some talk on twitter about considering an official project so we had a branch cut just so I could build something. (One can always fork but thats not really the point. I get what you are saying.) Ron, I'll leave it up to you to explore the UI based approach further. I'm still in the mind that we should build some components first and allow for a block to be a component selector. There's a lot of very cool "widget" types experiences that could be built with forms that don't require exposing raw twig templating or CSS/JS too. |
@brantwynn Following up on this - have you used the Snippet Manager module? (https://www.drupal.org/project/snippet_manager). It seems like what y'all are looking for, it lets you write Twig/CSS/JS in the UI and use those snippets on the site. I also released alpha1 of sfc if you want to try it out https://www.drupal.org/project/sfc |
Wow - the snippet manager is pretty slick looking! I still think we can use this as inspiration (and to steal code from) for sure. One of the immediate things I see is that this uses config entities for the snippet stuff. I think we would want a content entity so that we can revision it. Thats one of the problems I have with asset_injector (no revision). I also think we would want to extend the PDB or react_block modules so we can create different types of components (React, Vue, Ember, Angular, etc.) That being said, I appreciate the tribal knowledge share. I had no idea this was even a thing! |
https://git.drupalcode.org/sandbox/samuel.mortenson-3070857
We need to look at creating a revisionable entity and this code to create a decoupled component builder. User story:
We should also look at adding React/Redux support for this... common Redux store, common React libraries that are used, etc. Maybe we need a mashup with PDB as a dependency
The text was updated successfully, but these errors were encountered: