[wp-trac] [WordPress Trac] #33473: Shortcodes + Widgets. Unified "component" API (aka Content Blocks)

WordPress Trac noreply at wordpress.org
Fri Mar 18 00:37:47 UTC 2016


#33473: Shortcodes + Widgets. Unified "component" API (aka Content Blocks)
-----------------------------+-----------------------------
 Reporter:  brentjett@…      |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  Widgets          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+-----------------------------

Comment (by brentjett@…):

 Thanks guys for jumping into this! I, of course, love the idea of having a
 unified "View" format that could be used anywhere, and perhaps even down
 the road encourage some of the page builder projects to adopt the format
 similar to the way Fields API is hoping to gain adoption in the custom
 fields plugins. As far as a public API to easily register a single "view
 thingy" and get both a widget and a shortcode, it really isn't a stretch
 to create a subclass of WP_Widget that subsumes the responsibilities of
 both kinds of objects, sets up the shortcake ui and all that. That'd be an
 easy way to begin playing with API vocabulary.

 The one major hurdle that I see in the WP_Widget API is that the main
 widget array keys the declared widget types off the class name which
 prevents any widget controller class from backing multiple types of
 widgets. This is the reason, I think, that nobody has every written a good
 "Build Your Own Widgets" type plugin. You can't base multiple widgets on a
 single class and simply pass each instance some configuration data. Now if
 that were able to change and the widget API could use some other unique
 identifier, the opportunities to create this type of view object
 dynamically from a UI explodes.

 Incidentally, I've also been working with the lead developer at Beaver
 Builder lately and talking about their module format. There are a few
 things about it that I like, a few things I don't (same lack of class
 reuse as WP_Widget), but it's a good reference if you're looking for
 alternate view/component/module/widget sorts of implementations.
 https://www.wpbeaverbuilder.com/custom-module-documentation/

 Love to talk about this some more and happy to get involved!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33473#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list