1 package Reaction::UI::Widget::URI;
3 use Reaction::UI::WidgetClass;
4 use namespace::clean -except => [ qw(meta) ];
6 before fragment widget {
7 arg uri => $_{viewport}->uri;
10 implements fragment display_fragment {
11 my $vp = $_{viewport};
12 return unless $vp->has_display;
13 my $display = $vp->display;
14 if( blessed($display) && $display->isa('Reaction::UI::ViewPort')){
18 arg string_value => $display;
19 render 'display_string';
23 __PACKAGE__->meta->make_immutable;
32 Reaction::UI::Widget::URI - A hyperlink reference by URI value
36 This widget allows a layout template to render a hyperlink with either a
37 simple string or another viewport as the contents of the link.
43 Before the C<widget> fragment is rendered, the C<uri> argument will be set
44 to the return value of the C<uri> method on the viewport. The layout
45 will render a hyperlink with the C<uri> as value of the C<href> attribute and
46 the C<display_fragment> fragment as content of the element.
48 =head2 display_fragment
50 This will render nothing if the viewport doesn't return true when C<has_display>
51 is called on it. If it has a C<display> defined and it is a viewport, the C<_>
52 argument will be set to it and the C<viewport> fragment (inherited from
53 L<Reaction::UI::Widget> will be rendered. If the C<display> is not a viewport,
54 the C<string_value> argument will be set and the C<display_string> layout
57 C<display_fragment> is only implemented in the widget class.
61 Only implemented in the layout set. This will simply output the value of the
62 C<string_value> argument as content of the hyperlink element.
66 share/skin/base/layout/uri.tt
68 This layout set will look for a widget called C<URI> in the
69 C<widget_search_path>.
73 See L<Reaction::Class> for authors.
77 See L<Reaction::Class> for the license.