add ability to show metadata values in head blocks.

This commit is contained in:
Chris Nehren 2008-08-21 18:51:16 +00:00
parent c15ba6147f
commit 36eb8db8fc
43 changed files with 96 additions and 49 deletions

View file

@ -284,22 +284,27 @@ sub indexContent {
#-------------------------------------------------------------------
=head2 prepare ( )
=head2 prepare ( headerTemplateVariables )
This method sets the tags from the head block parameter of the template into the HTML head block in the style. You only need to call this method if you're using the HTML streaming features of WebGUI, like is done in the prepareView()/view()/www_view() methods of WebGUI assets.
=head3 headerTemplateVariables
A hash reference containing template variables to be processed for the head block. Typically obtained via $asset->getMetaDataAsTemplateVariables.
=cut
sub prepare {
my $self = shift;
my $vars = shift;
$self->{_prepared} = 1;
my $templateHeadersSent = $self->session->stow->get("templateHeadersSent") || [];
my @sent = @{$templateHeadersSent};
unless (isIn($self->getId, @sent)) { # don't send head block if we've already sent it for this template
if ($self->session->style->sent) {
$self->session->output->print($self->get("headBlock"));
$self->session->output->print($self->getParser($self->session, $self->get('parser'))->process($self->get('headBlock'), $vars));
} else {
$self->session->style->setRawHeadTags($self->get("headBlock"));
$self->session->style->setRawHeadTags($self->getParser($self->session, $self->get('parser'))->process($self->get('headBlock'), $vars));
}
}
push(@sent, $self->getId);