$block_data) { $blocks[$block_delta]['info'] = $block_data['title']; } return $blocks; case 'configure': $form = array(); // Provide form to enter ad details. $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; } } } /** * Are we in the appropriate forum to display that ad? */ function advert_is_in_forum($forum_id) { return ((arg(0) == 'forum') && (arg(1) == $forum_id)) || ((arg(0) == 'node') && is_numeric(arg(1)) && ($node = menu_get_object()) && (($node->type == 'forum') && ($node->tid == $forum_id))); }