Bugzilla – Attachment 18356 Details for
Bug 10206
Add Koha TT Plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10206 - Add Koha TT Plugin - Koha.Preference
Bug-10206---Add-Koha-TT-Plugin---KohaPreference.patch (text/plain), 2.59 KB, created by
Kyle M Hall (khall)
on 2013-05-23 17:32:43 UTC
(
hide
)
Description:
Bug 10206 - Add Koha TT Plugin - Koha.Preference
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-05-23 17:32:43 UTC
Size:
2.59 KB
patch
obsolete
>From 0944806e506ab8718011fb21ec7956880359c8f7 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 6 May 2013 14:25:23 -0400 >Subject: [PATCH] Bug 10206 - Add Koha TT Plugin - Koha.Preference > >This plugin is meant to be a place to put general purpose TT functions >directly related to Koha. If a plugin is not a filter, and does not >have more than one subroutine, that subroutine most likely belongs >in this TT plugin. > >This first and only function the plugin currently has is Preference, >which allows a template to get the value of a system preference without, >it needing to be passed in from a perl script. > >This plugin was already tested and signed off as part of bug 7441. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Template/Plugin/Koha.pm | 47 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 47 insertions(+), 0 deletions(-) > create mode 100644 Koha/Template/Plugin/Koha.pm > >diff --git a/Koha/Template/Plugin/Koha.pm b/Koha/Template/Plugin/Koha.pm >new file mode 100644 >index 0000000..2eff9f1 >--- /dev/null >+++ b/Koha/Template/Plugin/Koha.pm >@@ -0,0 +1,47 @@ >+package Koha::Template::Plugin::Koha; >+ >+# Copyright ByWater Solutions 2013 >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use base qw( Template::Plugin ); >+ >+use C4::Context; >+ >+=pod >+ >+This plugin contains various Koha replated Template Toolkit functions >+to help streamline Koha and to move logic from the Perl code into the >+Templates when it makes sense to do so. >+ >+To use, first, include the line '[% USE Koha %]' at the top >+of the template to enable the plugin. >+ >+For example: [% IF Koha.Preference( 'MyPreference ) == 'SettingA' %] >+removes the necessity of setting a template variable in Perl code for >+each and every system preference, even if no evaluation of the setting >+is necessary. >+ >+=cut >+ >+sub Preference { >+ my ( $self, $pref ) = @_; >+ return C4::Context->preference( $pref ); >+} >+ >+1; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10206
:
17969
|
18356
|
18357