justintadlock / block-pattern-builder

Build block patterns from the WordPress admin.
GNU General Public License v2.0
41 stars 9 forks source link

Easier way to create new Block Patterns #1

Closed HardeepAsrani closed 4 years ago

HardeepAsrani commented 4 years ago

The plugin seems great. One thing which I think will make it even better is to allow people to create new block patterns without leaving the editor.

Code will be similar to we use in our plugin: https://wordpress.org/plugins/blocks-export-import/

So when people make new blocks and want to turn it into a pattern, they can select the block(s) and click on "Add to Block Patterns," similar to how our plugin or Reusable Blocks work.

Screen Shot 2020-04-03 at 3 51 12 AM

Once the user clicks on it, they will get a Popup to add the name of the block pattern and it will be saved as Block Patterns post-type.

What do you think @justintadlock?

justintadlock commented 4 years ago

I think that is an excellent idea.

HardeepAsrani commented 4 years ago

I'll try to work and send a PR. You can review and let me know where to improve the code. OOP-PHP isn't my strongest skill. 😄

HardeepAsrani commented 4 years ago

Here's how it will work: https://www.loom.com/share/8f0ee1e7fb854f36a9caa0eedbf134d3

@justintadlock sending the code your way in moments. :)

justintadlock commented 4 years ago

Wow, that was fast! I'll want to study the code a bit, but it looks good with a quick scan. I'll probably merge when I can sit down with this a bit, then set up my normal script build system for familiarity.

justintadlock commented 4 years ago

I didn't really take much of an OOP approach with the PHP code though because I was just knocking out something basic very fast to kick-start this project.

HardeepAsrani commented 4 years ago

Yea, fortunately, I was able to update post type using Backbone so didn't need to write much code.