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

Allow editing "root" blueprints from the UI #3963

Closed

Conversation

Skullbock
Copy link

Hi, this is my first PR to statamic, so if i'm doing anything wrong, just let me know!

The idea behind this PR is that in the statamic docs, and several guides / blog posts i read is suggested that any non-collection driven blueprint that may be required for customization to the statamic site, such as database-releated blueprints, custom blueprints for other resources, etc, should be placed within the root directory of the blueprints folder, much like the user blueprint is.

This is very cool and useful, but i found out that those blueprints do not appear in the CP when added, and there needs to be edited directly from YAML.

This PR is an attempt to add this functionality to the CP. The code itself is pretty easy and straightforward, since most of it is already abstracted into the ManagesBlueprint trait.

Let me now what do you think!
Thanks

@duncanmcclean
Copy link
Member

duncanmcclean commented Jul 7, 2021

Hey dude, nice PR!

However, I actually sent in a pretty similar PR a couple months back (see #3015) and it was closed by the Core Team. There's some feedback on there.. Basically the takeaway was that we can register a 'blueprint section/group' for addons etc for non-content blueprints.

Sorry to be the bearer of bad news... 🙂

@Skullbock
Copy link
Author

hey @duncanmcclean thanks for taking the time and replying to me.

Those are actually good news because i could implement my custom blueprints with a new blueprint section. Is there already a PR for this?

@duncanmcclean
Copy link
Member

hey @duncanmcclean thanks for taking the time and replying to me.

Those are actually good news because i could implement my custom blueprints with a new blueprint section. Is there already a PR for this?

Not yet. I've thought of doing one but I just haven't had the time (and probably won't for a couple weeks at least). Feel free to incorporate that into this PR (or another one).

@Skullbock
Copy link
Author

Ok, so following the ideas stated in #3015 and the conversation in statamic/ideas#408 i refactored this to allow external code (see Addons / Service provider) to register custom groups of blueprints, by giving a title and a namespace where to look for blueprints.

The registration is done by calling the Blueprint facade new registerBlueprintGroup method, in any service provider:

\Statamic\Facade\Blueprint::registerBlueprintGroup('namespace', 'Title of the Group');

This new group, and all of the contained blueprints, are then shown in the blueprint list in the CP:

Schermata 2021-07-07 alle 12 06 59

Let me know if this solves the idea you guys had ;)

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

This is great!

resources/views/blueprints/index.blade.php Outdated Show resolved Hide resolved
resources/views/blueprints/index.blade.php Show resolved Hide resolved
Copy link
Member

@duncanmcclean duncanmcclean left a comment

Choose a reason for hiding this comment

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

I love this PR - I have a use case for this in one of my addons so I can't wait until this is merged and released.

There's just one little thing I noticed while giving it a go.

resources/views/blueprints/index.blade.php Outdated Show resolved Hide resolved
@edalzell
Copy link
Contributor

edalzell commented Jul 7, 2021

I'll take a look and see if I can update this to allow addons to "register" blueprints like the (almost) can fieldsets: #3717

@Skullbock
Copy link
Author

Thanks for everyone's comment, i pushed the changes your requested. Love the way this has been handled, thanks!
I felt very welcomed as a first time contributor

@duncanmcclean
Copy link
Member

One little tiny thing - you may want to fix the issues Style CI has highlighted, this won't be merged without those 🙂

@Skullbock
Copy link
Author

Should've fixed it.
Is there a reason why those style changes aren't commited automatically? I think it's just a burden on the contributor for no real reason, code style should IMHO be enforced automatically :)

@Skullbock
Copy link
Author

Hey! Is there anything else i can do for this PR? :)

@duncanmcclean
Copy link
Member

I think everything looks good.

It just takes a while sometimes for PR's to be reviewed & merged.

@Skullbock
Copy link
Author

Yeah, no issue with that, i was just checking if the PR needed some more work.
Btw i was just trying your runway addon, pretty neat! Together with this PR will make a great DX improvement for eloquent driven projects ;) Nice job!

@jasonvarga
Copy link
Member

Sorry I've been out of town (still am) so things have been a little slow here. This PR looks okay but I'll need to give it a more thorough review when I'm back. 👍

@Skullbock
Copy link
Author

Thanks :) i've added a couple of small things in the meantime

@jasonvarga
Copy link
Member

Hey there. We really appreciate the work that went into this and it's always difficult to close these down, but we're going to close it for now because it needs some more features added to it. I've explained it over on statamic/ideas#644 if you want to chime in over there. I don't want to ask you to implement them yourself. (Of course, you can if you want.)

When we implement it, we will give you co-author credit.

Thanks for understanding!

@jasonvarga jasonvarga closed this Sep 8, 2021
@Skullbock
Copy link
Author

Skullbock commented Sep 8, 2021 via email

@jasonvarga
Copy link
Member

It's not 3.3 - it could be done earlier in 3.2.x.

I know several addons providers are waiting for this

Can you list them? Then we can make sure all their use cases are covered.

@duncanmcclean
Copy link
Member

I'm waiting on it - loads of users of my Runway addon have asked for blueprint editing for 'Reaource' blueprints.

@jasonvarga
Copy link
Member

Yeah you're the one I know about. 😄

@edalzell
Copy link
Contributor

edalzell commented Sep 8, 2021

Can you list them? Then we can make sure all their use cases are covered.

Me, our "template" add-on would like to provide blueprints to our own sites, so we don't have to publish them and potentially overwrite any customizations

@jasonvarga
Copy link
Member

@edalzell But do you need to provide a blueprint? Where would the blueprint be used? In entries? If we go with the implementation outlined in the ideas issue, you'll be able to add custom blueprints, but not blueprints that'll go into blueprints/collections/something. Maybe chime in on that issue with what your plan is.

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.

None yet

4 participants