[Bug 31786] New: Sub template->param($var) should return the value
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786 Bug ID: 31786 Summary: Sub template->param($var) should return the value Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: m.de.rooy@rijksmuseum.nl QA Contact: testopia@bugs.koha-community.org Far easier than $template->{VARS}->{singleBranchMode} would be $template->param('singleBranchMode') What do you think? It seems a simple addition? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com, | |martin.renvoize@ptfs-europe | |.com, tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786 --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Easier or more elegant? Going thru VARS is hacky. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786 --- Comment #2 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- What is the context? Why don't you use CGI->param? :) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786 --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Jonathan Druart from comment #2)
What is the context? Why don't you use CGI->param? :)
See description too. If earlier code like C4/Auth already pushed info into the template object, it would be nice to read it back later (instead of requerying etc.). Yes, we can access {VARS} but that looks like a bad practice. In such a case CGI::param might not be in the picture. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #4 from David Cook <dcook@prosentient.com.au> --- (In reply to Marcel de Rooy from comment #3)
(In reply to Jonathan Druart from comment #2)
What is the context? Why don't you use CGI->param? :)
See description too. If earlier code like C4/Auth already pushed info into the template object, it would be nice to read it back later (instead of requerying etc.). Yes, we can access {VARS} but that looks like a bad practice. In such a case CGI::param might not be in the picture.
In frameworks like Catalyst and Mojolicious, the controller has a "stash" method which provides getting/setting of values to pass to the template. I've certainly used it for both getting and setting in both frameworks. Catalyst: $c->stash->{foo} = $bar; $c->stash( { moose => 'majestic', qux => 0 } ); $c->stash( bar => 1, gorch => 2 ); # equivalent to passing a hashref Mojolicious: my $name = $c->stash('name'); $c->stash(text => "Hello $name"); https://metacpan.org/pod/Catalyst#$c-%3Estash https://docs.mojolicious.org/Mojolicious/Guides/Tutorial#Stash-and-templates https://mojolicious.io/blog/2017/12/02/day-2-the-stash/ So returning a value from $template->param() does sound reasonable. However... I thought that we were moving away from $template->param() and to $template->{VARS} in general. (Although I don't see a Coding Guideline that says that.) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org