|
Date: 4/3/2007 2:57 am · Subject: Re: 7.4 Layout asset impossible to extend · Rating: 7
The problem lies in WebGUI::Asset::Wobject::Layout->prepareView. See the excerpt below (line nr's are from the svn as i write this) 148 sub prepareView { 149 my $self = shift; 150 $self->SUPER::prepareView; 151 my $children = $self->getLineage( ["children"], { returnObjects=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"] });
The problem is caused by line 151. The excludeClasses clause is hard coded and not changeable. If you extend the layout class with something you devised on your own this extension will obviously have a classname different from WebGUI::Asset::Wobject::Layout. This in combination with the hard coded excludeClasses clause will cause any extension to be displayed on the layout it's under. Now somewhere down the line prepareView is filtering out the assets that return false in canView(). I used this fact in my L33tout asset to work around the problem, but it's not a 'nice' solution: 117 #------------------------------------------------------------------- 118 sub canView { 119 my $self = shift; 120 121 # Ironically this is sort of a hack to 'hide' the l33tout from other 122 # container assets. It's necesarry b/c the Layout asset only considers 123 # itself to be an asset container, and does not take the assetContainers 124 # setting. 125 if (isIn(caller, @{$self->session->config->get("assetContainers")})) { 126 return 0; 127 } 128 129 return $self->SUPER::canView; 130 }
You can download the l33tout asset at http://www.plainblack.com/uploads/AR/mi/ARmiM8GqQhF9Y2pLOsM-tw/L33out-1.0.0.tar.gz
|