Changed default behavior to return nothing instead of the macro tag when no
matching collateral is found.
This commit is contained in:
parent
e8c305d919
commit
47015a8b26
6 changed files with 37 additions and 16 deletions
|
|
@ -28,8 +28,11 @@ sub process {
|
|||
}
|
||||
my @images = WebGUI::SQL->buildArray("select collateralId from collateral
|
||||
where collateralType='image' and collateralFolderId=".$collateralFolderId);
|
||||
my $collateral = WebGUI::Collateral->new($images[rand($#images+1)]);
|
||||
return '<img src="'.$collateral->getURL.'" '.$collateral->get("parameters").' />';
|
||||
if (my $collateral = WebGUI::Collateral->new($images[rand($#images+1)])) {
|
||||
return '<img src="'.$collateral->getURL.'" '.$collateral->get("parameters").' />';
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue