$block_data) { $blocks[$block_delta]['info'] = $block_data['title']; } return $blocks; case 'configure': $form = array(); $form[ADVERT_BLOCK_BODY . $delta] = array( '#type' => 'textarea', '#title' => t('HTML and/or Javascript'), '#description' => t('Enter HTML and/or Javascript to display in this block'), '#default_value' => variable_get(ADVERT_BLOCK_BODY . $delta, ''), ); return $form; case 'save': variable_set(ADVERT_BLOCK_BODY . $delta, $edit[ADVERT_BLOCK_BODY . $delta]); return; case 'view': $block_data = _advert_get_block($delta); $forum = $block_data['forum']; if (advert_is_in_forum($forum)) { $block['subject'] = $block_data['title']; $block['content'] = variable_get(ADVERT_BLOCK_BODY . $delta, ''); return $block; } } } /** * Check the visibility of the block, it should be on a forum basis */ function advert_is_in_forum($forum_id) { if (arg(0) == 'forum' && arg(1) == $forum_id) { return TRUE; } if (arg(0) == 'node' && is_numeric(arg(1))) { $node = node_load(arg(1)); if ($node->type == 'forum' && $node->tid == $forum_id) { return TRUE; } } return FALSE; }