comparison Lib/IMPL/Web/View/TTControl.pm @ 296:86ff93b34f2a

sync
author cin
date Tue, 05 Mar 2013 01:46:32 +0400
parents bbc0da7ef90e
children bd79145657e5
comparison
equal deleted inserted replaced
295:9b25e1f50144 296:86ff93b34f2a
4 use IMPL::Const qw(:prop); 4 use IMPL::Const qw(:prop);
5 use IMPL::lang qw(:hash); 5 use IMPL::lang qw(:hash);
6 use Scalar::Util qw(blessed); 6 use Scalar::Util qw(blessed);
7 use IMPL::declare { 7 use IMPL::declare {
8 require => { 8 require => {
9 TemplateDocument => 'Template::Document',
9 TTContext => 'Template::Context', 10 TTContext => 'Template::Context',
10 Exception => 'IMPL::Exception', 11 Exception => 'IMPL::Exception',
11 ArgumentException => '-IMPL::InvalidArgumentException', 12 ArgumentException => '-IMPL::InvalidArgumentException',
12 OperationException => '-IMPL::InvalidOperationException' 13 OperationException => '-IMPL::InvalidOperationException'
13 }, 14 },
111 return ""; 112 return "";
112 } 113 }
113 } 114 }
114 115
115 sub RenderBlock { 116 sub RenderBlock {
116 my ($this,$block, $args) = @_; 117 my ($this, $block, $args) = @_;
117 118
118 $args = {} unless ref $args eq 'HASH'; 119 $args = {} unless ref $args eq 'HASH';
119 120
120 return $this->context->include( $block, { %$args, this => $this, template => $this->template } ); 121 return $block ? $this->context->include( $block, { %$args, this => $this, template => $this->template } ) : undef;
122 }
123
124 sub ExportBlock {
125 my ($this,$block) = @_;
126
127 return TemplateDocument->new({
128 BLOCK => $this->template->blocks->{$block},
129 DEFBLOCKS => $this->template->blocks
130 });
121 } 131 }
122 132
123 sub AUTOLOAD { 133 sub AUTOLOAD {
124 our $AUTOLOAD; 134 our $AUTOLOAD;
125 135