package Reaction::UI::Widget::URI; use Reaction::UI::WidgetClass; use namespace::clean -except => [ qw(meta) ]; before fragment widget { arg uri => $_{viewport}->uri; }; implements fragment display_fragment { my $vp = $_{viewport}; return unless $vp->has_display; my $display = $vp->display; if( blessed($display) && $display->isa('Reaction::UI::ViewPort')){ arg '_' => $display; render 'viewport'; } else { arg string_value => $display; render 'display_string'; } }; __PACKAGE__->meta->make_immutable; 1; __END__; =head1 NAME Reaction::UI::Widget::URI - A hyperlink reference by URI value =head1 DESCRIPTION This widget allows a layout template to render a hyperlink with either a simple string or another viewport as the contents of the link. =head1 FRAGMENTS =head2 widget Before the C fragment is rendered, the C argument will be set to the return value of the C method on the viewport. The layout will render a hyperlink with the C as value of the C attribute and the C fragment as content of the element. =head2 display_fragment This will render nothing if the viewport doesn't return true when C is called on it. If it has a C defined and it is a viewport, the C<_> argument will be set to it and the C fragment (inherited from L will be rendered. If the C is not a viewport, the C argument will be set and the C layout will be rendered. C is only implemented in the widget class. =head2 display_string Only implemented in the layout set. This will simply output the value of the C argument as content of the hyperlink element. =head1 LAYOUT SET share/skin/base/layout/uri.tt This layout set will look for a widget called C in the C. =head1 AUTHORS See L for authors. =head1 LICENSE See L for the license. =cut