4.7.x common.inc drupal_set_content($region = null, $data = null)
5.x common.inc drupal_set_content($region = NULL, $data = NULL)
6.x common.inc drupal_set_content($region = NULL, $data = NULL)

Set content for a specified region.


$region: Page region the content is assigned to.

$data: Content to be set.

4 calls to drupal_set_content()
drupal_get_content in includes/common.inc
Get assigned content.
install_task_list in ./install.php
Add the installation task list to the current page.
template_preprocess_block_admin_display_form in modules/block/block.admin.inc
Process variables for block-admin-display.tpl.php.
update_task_list in ./update.php
Add the update task list to the current page.


includes/common.inc, line 47
Common functions that many Drupal modules will need to reference.


function drupal_set_content($region = NULL, $data = NULL) {
  static $content = array();
  if (!is_null($region) && !is_null($data)) {
    $content[$region][] = $data;
  return $content;


meonkeys’s picture

What provides this functionality in Drupal 7?

doublejosh’s picture

Wondering as well. I'd like to do this in a forward compatible way.

My use care is programmatically inserting blocks into the closure that non-devs have access to edit.

andypost’s picture

You could use hook_page_alter() to insert any custom data into regions or hook_page_build()

askibinski’s picture

This function has been renamed to drupal_add_region_content in Drupal 7.

jrgriffin’s picture

Do the two arguments get set to NULL no matter what you pass into the function? Why does a set function return anything?

Ayesh’s picture

Most of the drupal_set_* functions actually returned the whole item even though they are named "set". See drupal_set_breadcrumb and drupal_set_title for examples.