Create an accompanying composer package which provides utility functions for the JS counterparts
Currently, there are many components that make everything much easier on the JS side of things. But it's still a pain in PHP. So I think we should create a composer package that gets releases alongside the npm package with the same functionality in PHP.
Here are some examples of what this should include:
- register icons similar to how it works in JS
- render an icon that was registered
- render the markup of a link that was created with the link component
- render the markup that was created with an image component
Once we have such a system we can also tackle some larger issues like for example automatic query exclusion of items that get hand-picked using the content picker in any blocks.
I'm still trying to decide whether a composer package is the right choice or whether building this as a plugin would be a better idea. If we would be building it as a plugin it would allow us to more easily manage updates of both dependencies. We could even do something similar to WordPress core and woocommerce where we have our own version of the dependency extraction webpack plugin which handles enqueueing all of the appropriate scripts at the correct time and place.
This would also fix #97
But it has the huge downside of making it a little harder to adopt the package for anyone not using the 10up scaffold, toolkit etc.