Summary: | Koha should provide Koha plugins with a template to use with Template::Toolkit WRAPPER | ||
---|---|---|---|
Product: | Koha | Reporter: | David Cook <dcook> |
Component: | Plugin architecture | Assignee: | David Cook <dcook> |
Status: | RESOLVED DUPLICATE | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | fridolin.somers, m.de.rooy |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: |
Description
David Cook
2020-09-04 06:01:52 UTC
This could make it easier to support Koha plugins across multiple versions, since the different Koha versions would provide their own wrappers. (I admit that this could maybe create compatibility issues if the Koha plugin HTML isn't written well or somehow conflicts with the mainstream Koha wrapper.) I think that I could also be happy with Koha plugin specific wrappers, so long as they could be reusable within the same plugin. I need to play with the INCLUDE directive a bit to see whether or not Koha needs to be patched to add include directories for plugins... (In reply to David Cook from comment #2) > I think that I could also be happy with Koha plugin specific wrappers, so > long as they could be reusable within the same plugin. > > I need to play with the INCLUDE directive a bit to see whether or not Koha > needs to be patched to add include directories for plugins... Here's a solution: MyPlugin.pm: my $template = $self->get_template({ file => 'report-step1.tt' }); my $wrapper = $self->mbf_path('wrapper.tt'); $template->param( plugin_wrapper => $wrapper, ); report-step1.tt: [% WRAPPER $plugin_wrapper name = 'My Plugin' breadcrumb = 'My Plugin' %] <div>Plugin content</div> [% END %] Excellent! There's other ways we could do this, but that worked pretty well. Actually, here is a more modern wrapper for a report plugin I think... [% INCLUDE 'doc-head-open.inc' %] <title>Koha: [% name %]</title> [% INCLUDE 'doc-head-close.inc' %] </head> <body> [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a> › [% breadcrumb %]</div> <div class="main container-fluid"> <div class="row"> <div class="col-sm-10 col-sm-push-2"> <main> [% content %] </main> </div> <div class="col-sm-2 col-sm-pull-10"> <aside> [% INCLUDE 'reports-menu.inc' %] </aside> </div> </div> [% INCLUDE 'intranet-bottom.inc' %] |