You are here

function ds_render_region in Display Suite 7

Render a region.

Parameters

$content: An array of content fields.

$region: The name of region to render.

$layout: The layout definition.

1 call to ds_render_region()
ds_entity_variables in ./ds.module
Add variables to an entity.

File

./ds.module, line 916
Display Suite core functions.

Code

function ds_render_region($content, $region, $layout) {
  $output = '';
  if (isset($layout['settings']['regions'][$region])) {
    foreach ($layout['settings']['regions'][$region] as $key => $field) {

      // Make sure the field exists.
      if (!isset($content[$field])) {
        continue;
      }

      // Safe-guard against strings.
      if (is_string($content[$field])) {
        $output .= $content[$field];
      }
      else {
        $output .= drupal_render($content[$field]);
      }
    }
  }
  return $output;
}