You are here

function google_admanager_block_view in DFP Small Business (Google Ad Manager) 7.2

Implements hook_block_view().

File

./google_admanager.module, line 68

Code

function google_admanager_block_view($delta = '') {
  $ad_slots = _google_admanager_get_ad_slots();
  $block = array(
    'subject' => '',
    'content' => '',
  );
  if ($id = variable_get('google_admanager_account', '')) {
    if (isset($ad_slots[$delta])) {

      // ad slot
      $block['content'] = theme('google_admanager_block', array(
        'id' => $id,
        'ad_slot' => $ad_slots[$delta],
      ));
    }
    elseif (substr($delta, 0, 10) == 'superslot:') {

      // superslot
      $superslots = variable_get('google_admanager_superslots', array());
      if ($superslot = $superslots[substr($delta, 10)]) {
        foreach ($superslot as $ad_slot => $php) {
          if (eval($php)) {
            $block['content'] .= theme('google_admanager_block', array(
              'id' => $id,
              'ad_slot' => $ad_slot,
            ));
          }
        }
      }
    }
  }
  return $block;
}