WebDevStudios / oops-wp

A collection of abstract classes, interfaces, and traits to promote object-oriented programming practices in WordPress.
57 stars 9 forks source link

Issue/#2 add abstract data structure for shortcode registration #12

Closed jmichaelward closed 5 years ago

jmichaelward commented 5 years ago

Closes #2

I think this about covers everything that would be needed to set up a new Shortcode object. This PR includes a new interface, Renderable, which would be useful for any objects that need to render content to the screen. As far as I can recall, all shortcodes get rendered, so this should be a valid use case for this interface in the abstract class.

I also added some light validation to throw an exception if the shortcode isn't set or if it isn't a string, but we could probably extend that to ensure they actually adhere to WordPress's expectation.