Apply custom props programmatically

Support MB Blocks Apply custom props programmatically

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27185
    JackkyJackky
    Participant

    Hi! I'm willing to make some global props native controls for all types of blocks (core, mb-blocks etc.) like style select dropdowns, visibility checkboxes and more. I'm doing all like in this tutorial: https://jeffreycarandang.com/extending-gutenberg-core-blocks-with-custom-attributes-and-controls/ and it works great on native core blocks, but on mb blocks the props wont be saved within a js filter 'blocks.getSaveContent.extraProps', because the block is renderd with a render_callback via php. I'm wondering, what should I do to hook into mb-blocks and set this props on block edit and save?

    #27199
    Long NguyenLong Nguyen
    Moderator

    Hi Jackky,

    Thanks for your suggestion.

    MB Blocks create blocks by custom fields via PHP code so it is different from native JS to create global props. I will inform the development team to consider adding this case to the development roadmap.

    #27464
    JackkyJackky
    Participant

    Oh...( Really? No any hacky way to do this? There is no public filters etc. on block save\update? Seriously? Need this a lot. Also MetaBox is positioning itself as a great framework-like tool for programmers, not a wysiwyg-like solution for no-code experience. And I (I think, I'm not alone in this thought) expect to have all the necessary filters\hooks for my development with this solution. Otherwise, one day, unfortunately, I will have to stop using the MetaBox and switch to using native block-building practicies or some advanced solutions. Because things like this is really important.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.