Skip to content

Commit

Permalink
add extension point for updating random ad
Browse files Browse the repository at this point in the history
possibility to filter the DataList in an extension
  • Loading branch information
wernerkrauss committed Aug 18, 2015
1 parent 2a0f887 commit 9d47831
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions code/extensions/UniadsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public function getAdsByZone(UniadsZone $zone){

/**
* @param UniadsZone $zone
* @todo: filter out already displayed ads or campaigns
* @return UniadsObject
*/
public function getRandomAdByZone(UniadsZone $zone)
Expand All @@ -196,9 +197,11 @@ public function getRandomAdByZone(UniadsZone $zone)

$ad =$this->getAdsByZone($zone)
->filter(array('Weight:GreaterThanOrEqual' => $weight))
->sort($randomString)
->First();
return $ad;
->sort($randomString);

$this->owner->extend('UpdateRandomAdByZone', $ad);

return $ad->First();;
}


Expand Down

0 comments on commit 9d47831

Please sign in to comment.