Call prepareView on child assets in the prepareView phase to prevent their head tags showing up in our body.
This commit is contained in:
parent
d325e7a301
commit
fffdb9d1a0
1 changed files with 21 additions and 11 deletions
|
|
@ -52,12 +52,16 @@ sub definition {
|
||||||
sub getIssues {
|
sub getIssues {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
my $issues = $self->getLineage( [ 'children' ], {
|
# Caching of instanciated assets is not for speed, but is requied since prepareView is called on them, and we
|
||||||
|
# need them again in that state in getViewVars.
|
||||||
|
unless ( $self->{ _issues } ) {
|
||||||
|
$self->{ _issues } = $self->getLineage( [ 'children' ], {
|
||||||
returnObjects => 1,
|
returnObjects => 1,
|
||||||
orderByClause => 'lineage desc',
|
orderByClause => 'lineage desc',
|
||||||
} );
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
return $issues;
|
return $self->{ _issues };
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -88,7 +92,8 @@ sub getAssetContent {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $asset = shift;
|
my $asset = shift;
|
||||||
|
|
||||||
$asset->prepareView;
|
# Do not call prepareView on $asset here but rather do this in our own prepareView to prevent head tags being
|
||||||
|
# written to body.
|
||||||
my $content = $asset->view;
|
my $content = $asset->view;
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
|
@ -106,6 +111,11 @@ sub prepareView {
|
||||||
|
|
||||||
$self->{ _viewTemplate } = $template;
|
$self->{ _viewTemplate } = $template;
|
||||||
|
|
||||||
|
# Call prepareview on issues here, to prevent head tags ending up in the body.
|
||||||
|
foreach my $issue ( @{ $self->getIssues } ) {
|
||||||
|
$issue->prepareView;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue