Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Interchange: cvs

[interchange] Allow passing params to error tag, which are replaced (same functionality as [warnings]). Useful for

 

 

Interchange cvs RSS feed   Index | Next | Previous | View Threaded


interchange-cvs at icdevgroup

Jul 3, 2013, 1:46 PM

Post #1 of 1 (40 views)
Permalink
[interchange] Allow passing params to error tag, which are replaced (same functionality as [warnings]). Useful for

commit bd39e2c6ceea6f1d2f97cee4283406777544f616
Author: Josh Lavin <josh [at] perusion>
Date: Wed Jul 3 13:44:00 2013 -0700

Allow passing params to error tag, which are replaced (same functionality as [warnings]). Useful for localization.

Example:
[.error
name=username
set="That was a bad username. Please contact us at %s or %s."
param.0="(800) 555-1212"
param.1="(512) 555-1212"
]

code/SystemTag/error.coretag | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/code/SystemTag/error.coretag b/code/SystemTag/error.coretag
index 18e4adb..c120470 100644
--- a/code/SystemTag/error.coretag
+++ b/code/SystemTag/error.coretag
@@ -37,6 +37,10 @@ sub tag_error {
if($opt->{set}) {
$opt->{keep} = 1 unless defined $opt->{keep};
my $error = delete $opt->{set};
+ if($opt->{param}) {
+ $opt->{param} = [ $opt->{param} ] unless ref($opt->{param} );
+ $error = sprintf($error, @{$opt->{param}});
+ }
return set_error($error, $var, $opt);
}
my $err_ref = $Vend::Session->{errors};

_______________________________________________
interchange-cvs mailing list
interchange-cvs [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-cvs

Interchange cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.