1

I'm trying to get a full list of blocks that are active content on current page. Preferably it would include details of what type of content is displayed in the block.

I need this information to display adds in the blocks. The adds need to be loaded through a javascript snippet, that I can place in the header (through drupal_add_js). But first I need to know if the block that contains the add is active and that's why I need this list of blocks.

I'm using Drupal 7.

  • do you want to get the id of the block to use it in the js? – Mohammed Shameem Jan 23 '13 at 5:40
0

Follow the instruction to get the details of block for current page

  • In this template_preprocess_page function You can get a variable in that u have all region and it's block array
  • Using the above function we can get all the information of blocks note(if u want to see know the regions list see this function system_region_list
0

If you want dump out all the blocks on page then do the following:

function THEME_preprocess_block(&$vars) {
   var_dump($vars);
   // dsm(); // If Devel module installed.
}

You do this in your themes template file, replacing THEME (above) with your theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.