You are here

function theme_ds_eval_block in Display Suite 6

Same name and namespace in other branches
  1. 6.3 theme/theme.inc \theme_ds_eval_block()
  2. 6.2 theme/theme.inc \theme_ds_eval_block()

Evaluate block field.

Parameters

array $field The field array.:

1 theme call to theme_ds_eval_block()
ds_build_fields_and_regions in ./ds.module
Get fields and regions for an object.

File

theme/theme.inc, line 105
Theming functions for ds.

Code

function theme_ds_eval_block($field) {
  if (isset($field['properties'])) {
    list($module, $delta) = explode('|', $field['properties']['block']);
    $block = module_invoke($module, 'block', 'view', $delta);
    if (!empty($block)) {
      switch ($field['properties']['render']) {
        case DS_BLOCK_TEMPLATE:
          global $theme_key;
          if ($block['content']) {
            $block = (object) $block;
            $block->region = NULL;
            $block->module = $module;
            $block->delta = $delta;
            $block_title = db_result(db_query("SELECT title FROM {blocks} WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $module, $delta, $theme_key));
            if (!empty($block_title)) {
              $block->subject = $block_title == '<none>' ? '' : check_plain($block_title);
            }
            $content = theme('block', $block);
          }
          break;
        case DS_BLOCK_TITLE_CONTENT:
          $content = '<h2 class="block-title">' . $block['subject'] . '</h2>';
          $content .= $block['content'];
          break;
        case DS_BLOCK_CONTENT:
          $content = $block['content'];
          break;
      }
      return $content;
    }
  }
}