Mobile template is not being inherited (#12246)
Break get_add_instance out of www_add; subclass it in Layout to pull mobileTemplateId and mobileStyleTemplateId from the parent if the parent is also a Layout.
This commit is contained in:
parent
b05c7ea810
commit
ee121e9460
4 changed files with 110 additions and 25 deletions
|
|
@ -514,5 +514,35 @@ sub www_view {
|
|||
return $self->SUPER::www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 get_add_instance ()
|
||||
|
||||
Subclass the standard C<get_add_instance> to inherit
|
||||
C<mobileStyleTemplateId> and C<mobileTemplateId> from the parent asset if it is an instance of
|
||||
L<WebGUI::Asset::Wobject::Layout>.
|
||||
|
||||
=cut
|
||||
|
||||
sub get_add_instance {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $parentAsset = shift;
|
||||
my $url = shift;
|
||||
my $prototype = shift;
|
||||
|
||||
my $instance = $class->SUPER::get_add_instance( $session, $parentAsset, $url, $prototype, @_ );
|
||||
|
||||
if( $parentAsset->isa('WebGUI::Asset::Wobject::Layout') ) {
|
||||
$instance->update({
|
||||
mobileStyleTemplateId => $parentAsset->get("mobileStyleTemplateId"),
|
||||
mobileTemplateId => $parentAsset->get("mobileTemplateId"),
|
||||
});
|
||||
}
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue