Correct way to add a Panel via Package
Permalink 1 user found helpfulI broke the task down as follows:
1. Override or add to /elements/panels/page
2. Add view and controller file
3. Implement custom functionality
#1. I found some info how to override Core files in a package:
public function on_start() { $env = Environment::get(); $env->overrideCoreByPackage('elements/panels/page.php', $this); }
That's probably not a good way, what happens if another package overrides the same file? What's a better way?
#2. Where do I add those? Can I just put /views/panels/details/page/custompanel.php in my package and it will be available? Since this doesn't work with /elements I am not so sure. (Same for controller). And if it works how do I reference it in the data-pane-detail-url attribute?
data-panel-detail-url="<?php echo URL::to('/ccm/system/panels/details/page/preview') ?>"
Probably some more questions will pop up along the way but it would be great if someone could shed some light on the general approach to take. I would imagine there even might be a undocumented createPanel function somewhere.
This is interesting.
Will you show what you made when you are finished? I would like to see it.
I'm not sure if there is a way to add your custom stuff to panel without overriding it. At least I couldn't find any "panel::registerPanel( 'my_panel' )" kind of thing anywhere.