Right now plugins can and do include template files. Mostly those files are views, sometimes storefront related, most often admin views.
For a while now I’ve been postponing to update some of the remaining currently defunct plugins to the new plugin conventions and mostly because they include sideboxes.
The old plugins would create/copy sidebox files into the default theme during the installation process. This is not very nice on a number of levels. It’s error prone (file permissions), not intuitive and generally something I never liked at all
With the enhanced support for storefront views and resources in plugins it might be time to rethink the location of views within the plugin. Right now all there is is stored in a subfolder named ‘views‘. So, in order to keep plugin folders tidy, it would make sense to have a content folder, just like themes. That way all resources, views, sideboxes, etc. would be tucked away and not interfere with the actual plugin code.
Now, if you go that far, you might ask: Why stop here? Add support for themes! Well, then things get a bit more complicated. In particular since the id of the default theme is configurable, it’s hard to anticipate that.
Of course, it would be possible to declare ‘default’ the name of the folder associated with the configured default theme, but then things, again, become less intuitive (although ‘default’ really really is a great clue!).
So, I think I’ll change the code to expect templates and resources relative to a ‘content’ folder within a plugin. That would mean existing views folder would move one level down to ‘content/views’.
If theme specific customization is required, it is still better to copy the files into your theme and customize them there. Files in plugins should never need to be modified.
Coming back to plugins that contain sideboxes. Since the (to be) content folder is automatically included in the template file lookup [via ->fetch(...)], there is no need to copy any more. To make those sideboxes show up in the admin page, the sidebox dummy patch can easily be modified to scan plugins too.