Skip to content
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

Split blueprints for forms #204

Closed
royduin opened this issue Sep 15, 2023 · 12 comments · Fixed by #300
Closed

Split blueprints for forms #204

royduin opened this issue Sep 15, 2023 · 12 comments · Fixed by #300
Labels
feature request New feature or request

Comments

@royduin
Copy link

royduin commented Sep 15, 2023

Currently we did set the blueprints driver to "file" and disable the permissions to change them on all environments (through https://github.com/justbetter/statamic-environment-permissions) so the end user can not make blueprint changes. This is great as the customer should not make any blueprint changes to collections, taxonomies, globals, etc as changing it could case the frontend to break. And if the customer wants to add something; that should probably be visible at the frontend so a developer is needed to handle it. But.. a form blueprint is more like content.

We made it dynamic with: https://github.com/rapidez/statamic/blob/master/resources/views/page_builder/form.blade.php so the customer should be able to create their own forms.

Can we split this? So form blueprints are stored in the database and the rest in a file? Probably something with permissions also need to change within Statamic itself?

@ryanmitchell
Copy link
Contributor

Closing as it a duplicate of #164

@royduin
Copy link
Author

royduin commented Sep 15, 2023

But that's about form submissions, not the form blueprint.

@ryanmitchell
Copy link
Contributor

You can have all blueprints in the database or all in file. There is no distinction between the type of blueprint.

@royduin
Copy link
Author

royduin commented Sep 15, 2023

Yeah, that's the point. We'd like to split that so we can version control the blueprints of collections, globals, etc and have the form blueprints in the database as that's more like content.

@ryanmitchell
Copy link
Contributor

Yep I understand - thats not currently possible. I'll open this back up, but being honest I'm not sure if/how it could be done.

@ryanmitchell ryanmitchell reopened this Sep 15, 2023
@royduin
Copy link
Author

royduin commented Sep 15, 2023

Just to keep track of it and maybe see if other users want this as well. If we find some time we'll dig into this further.

@ryanmitchell
Copy link
Contributor

With recent Statamic versions there is a separate permission for form blueprint editing to regular blueprint editing. Does this solve the problem for you?

@royduin
Copy link
Author

royduin commented Oct 11, 2023

That's nice but we also need that separation here: https://github.com/statamic/eloquent-driver/blob/master/config/eloquent-driver.php#L19-L23 so form blueprints can be stored in the database and all others can stay in file.

@ryanmitchell
Copy link
Contributor

I don't think that's something this driver should support.

That said, you could do it by binding your own BlueprintRepository and amending the in() method to check for file by default, and use eloquent if the namespace is form.

public function in(string $namespace)

@ryanmitchell ryanmitchell added the feature request New feature or request label Oct 11, 2023
@royduin
Copy link
Author

royduin commented Oct 11, 2023

I'll dig into this soon, so a PR won't be accepted?

@ryanmitchell
Copy link
Contributor

I dont really see it that form blueprints are 'content' - to me the submissions are content, and forms are similar to collections. We've given the ability to have a split config on each repository, but within a repository itself seems quite niche.

So to answer your question I'd be leaning towards no, but I'm open to being convinced.

It may also be that this driver isnt the right place for it as it may be better as a standalone add-on for those that want that level of flexibility.

@ryanmitchell
Copy link
Contributor

@royduin just in case you didnt get notified, it's now supported in v4.3.0 as it was requested by someone else. I guess I was wrong and people do want it to work like this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants