src/Twig/Extension/AdvertisingGeneric.php
/**
     * Show an banner from provider.
     */
Show an banner from provider.
Show an banner from provider .
public function showBanner(string $network, string $adSlot): string
    {
        $event = new EventTwig();
        $event->setNetwork($network);
        $event->setSlot($adSlot);
        $this->dispatcher->dispatch($event, EventTwig::TWIG_GENERIC_SELECT_BANNER_PRE);
        $banner = $event->getBanner();
        if ( ! $banner)
        {
            $net    = $this->networks->getNetwork($event->getNetwork());
            $banner = $net->getBanner($event->getSlot());
            if ($banner)
            {
                $this->networks
                    ->setNetworkHasBanners($network)
                    ->addScriptUrl($network, $net->getScriptUrl())
                ;
            }
        }
        $event->setBanner($banner);
        $this->dispatcher->dispatch($event, EventTwig::TWIG_GENERIC_SELECT_BANNER_POST);
        return $event->getBanner();
    }
public function showBanner ( string $ network , string $ adSlot ) : string { $ event = new EventTwig ( ) ; $ event -> setNetwork ( $ network ) ; $ event -> setSlot ( $ adSlot ) ; $ this -> dispatcher -> dispatch ( $ event , EventTwig :: TWIG_GENERIC_SELECT_BANNER_PRE ) ; $ banner = $ event -> getBanner ( ) ; if ( ! $ banner ) { $ net = $ this -> networks -> getNetwork ( $ event -> getNetwork ( ) ) ; $ banner = $ net -> getBanner ( $ event -> getSlot ( ) ) ; if ( $ banner ) { $ this -> networks -> setNetworkHasBanners ( $ network ) -> addScriptUrl ( $ network , $ net -> getScriptUrl ( ) ) ; } } $ event -> setBanner ( $ banner ) ; $ this -> dispatcher -> dispatch ( $ event , EventTwig :: TWIG_GENERIC_SELECT_BANNER_POST ) ; return $ event -> getBanner ( ) ; }
Show an banner from provider.
Show an banner from provider .
//-- Allow to select a custom banner //-- Allow to overwrite/manipulate/delete banner