Inserting a block from a module into theme

echo-creations

Joined: 2012-08-07
Posts: 6
Posted: Tue, 2012-08-07 14:31

Hello,
I try to move the album carousel to a specific position into my theme, so I created a album_carousel_block.php class :

class album_carousel_block_Core {
  static function get_site_list() {
    return array("album_carousel" => t("Album carousel"));
  }
  static function get($block_id, $theme) {
    $block = "";
    switch ($block_id) {
    case "album_carousel":
	  $block->css_id = "g-album_carousel";
      $block->title = t("Album Carousel");
      $block = new Block();
      $block->content = new View("album_carousel.html");
    }
    return $block;
  }
}

And then call it inside the theme with this :

album_carousel_block::get("album_carousel", $theme)

It just returns me a blank line. I verified that the function was called, code seems correct to me but it doesn't seems to work.
Any advice ?
Thank you very much

 
chaosdax

Joined: 2005-12-27
Posts: 37
Posted: Fri, 2012-08-10 02:56

Very curious to hear a response on this, wanting to add a block from another module in the album page.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2012-10-07 07:36
Quote:
And then call it inside the theme with this :

album_carousel_block::get("album_carousel", $theme)

Adding:<?= album_carousel_block::get("album_carousel", $theme); ?> works for me.
Note the = or you could use echo if so inclined.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team