Call in a block that is generated by another module

coryroc - September 4, 2008 - 20:53
Project:Magic Tabs
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:coryroc
Status:closed
Description

The magic tabs have been working great! I have been able to call in my views and have the following code:

function magic_tabs_example_callback($active = 0) {
  $tabs[] = array(
    'title' => t('Events'),
    'content' => theme('view', 'Tabs_Events'),
  );
  $tabs[] = array(
    'title' => t('News'),
    'content' => theme('view', 'Tabs_News'),
  );
  $tabs[] = array(
    'title' => t('Stay Informed'),
    'content' => t('<p>Content of Stay Informed</p>'),
  );
  return $tabs;
}

For the "Stay Informed" tab I'd like to call in a block that is created by the simplenews module. I tried various ways using the "custom block" method but didn't have any luck b/c the $bid isn't equal to a number. For instance, when I mouse over "configure" to get the block id of my simplenews block, I get the following path: /admin/build/block/configure/simplenews/newsletter-4 instead of the usual "/admin/build/block/configure/block/82" for custom blocks.

How can I adapt the following code to call in the simplenews block:

$bid = 2;
  $block = (object)module_invoke('block', 'block', 'view', $bid);
  $block->module = 'block';
  $block->delta = $bid;
  $tabs[] = array(
    'title' => t('Stay Informed'),
    'content' => theme('block', $block),
  );

Any help is GREATLY appreciated!

#1

coryroc - September 4, 2008 - 23:00

Nevermind, I FIGURED IT OUT! My code for the last tab is as follows:

  $bid = 'newsletter-4';
  $block = (object)module_invoke('Simplenews', 'block', 'view', $bid);
  $block->module = 'block';
  $block->delta = $bid;
  $tabs[] = array(
    'title' => t('Stay Informed'),
    'content' => theme('block', $block),
  );

#2

coryroc - September 4, 2008 - 23:02
Assigned to:Anonymous» coryroc
Status:active» fixed

see above.

#3

Anonymous (not verified) - September 18, 2008 - 23:12
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.