[Jifty-commit] r7585 - jifty/trunk/lib/Jifty/Web

Jifty commits jifty-commit at lists.jifty.org
Tue Nov 3 18:18:25 EST 2009


Author: jesse
Date: Tue Nov  3 18:18:25 2009
New Revision: 7585

Modified:
   jifty/trunk/lib/Jifty/Web/Menu.pm

Log:
add a "raw_html" option to Jifty::Web::Menu items

Modified: jifty/trunk/lib/Jifty/Web/Menu.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Menu.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Menu.pm	Tue Nov  3 18:18:25 2009
@@ -10,6 +10,7 @@
 
 __PACKAGE__->mk_accessors(qw(
     label sort_order link target escape_label class render_children_inline
+    raw_html
 ));
 
 =head1 NAME
@@ -57,6 +58,11 @@
 
 =cut
 
+=head2 raw_html [STRING]
+
+Sets the content of this menu item to a raw blob of HTML. When 
+asked or output, rather than constructing a link, Jifty will return 
+this raw content. No escaping is done.
 
 sub parent {
     my $self = shift;
@@ -483,7 +489,10 @@
     # Stringifying $self->link may return '' and output something, so
     # we need to be careful to not stringify it more than once, and to
     # check it for defined-ness, not truth.
-    if ( defined (my $str = $self->link) ) {
+    if  ( my $raw = $self->raw_html) {
+        return $raw;
+    }
+    elsif ( defined (my $str = $self->link) ) {
         return $str;
     } elsif ( $self->url ) {
         return Jifty->web->link( label => _( $self->label ),


More information about the Jifty-commit mailing list