Question

I am searching for something equivalent of drupal_set_content() for Drupal 7, to assign a block to a region. Do you have any idea?

Was it helpful?

Solution

The equivalent of drupal_set_content() is drupal_add_region_content().

Adds content to a specified region.

Parameters

$region: Page region the content is added to.

$data: Content to be added.

Notice there was a bug in Drupal that didn't allow this function to work, since drupal_region_content() was not properly called. (See Content added via drupal_add_region_content() is not added to pages.) It has been fixed on March 2015; if you are using any version earlier than 7.36, drupal_add_region_content() will not work.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top