You are here

function adsense_managed_block_view in Google AdSense integration 7

Implements hook_block_view().

File

managed/adsense_managed.module, line 255
Displays Google AdSense ads on Drupal pages.

Code

function adsense_managed_block_view($delta = '') {
  $block = array();
  if (_adsense_page_match()) {
    $ad = _adsense_managed_get_block_config($delta);
    $format = $ad[1] == 'custom' ? $ad[5] . 'x' . $ad[6] : $ad[1];
    $shape = isset($ad[4]) ? $ad[4] : 'auto';
    $layout_key = isset($ad[7]) ? $ad[7] : '';
    $block['content'] = $ad ? adsense_display(array(
      'title' => $ad[0],
      'format' => $format,
      'slot' => $ad[2],
      'shape' => $shape,
      'layout_key' => $layout_key,
    )) : _adsense_configure_block_message(url('admin/structure/block/manage/adsense_managed/' . $delta));
    if (!empty($ad[3])) {
      $block['content'] = "<div style='text-align:{$ad[3]}'>{$block['content']}</div>";
    }
  }
  return $block;
}