You are here

function _blockreference_formatter_get_block in Block reference 7.2

Helper function for theming normal block views, returns appropriate block.

4 calls to _blockreference_formatter_get_block()
theme_blockreference_formatter_default in ./blockreference.module
Theme function for 'default' blockreference field formatter.
theme_blockreference_formatter_plain in ./blockreference.module
Theme function for 'plain' blockreference field formatter.
theme_blockreference_formatter_title in ./blockreference.module
Theme function for 'title' blockreference field formatter.
theme_blockreference_formatter_without_title in ./blockreference.module
Theme function for 'without_title' blockreference field formatter.

File

./blockreference.module, line 400

Code

function _blockreference_formatter_get_block($element) {
  $item = $element['item'];
  if (@$item['moddelta']) {
    list($module, $delta) = explode(':', $item['moddelta']);
    $block = _blockreference_block($module, $delta);
    if ($block) {

      // Fetch all `block` columns for this block, any theme.
      $query = db_select('block', 'b')
        ->fields('b')
        ->condition('module', $module)
        ->condition('delta', $delta)
        ->execute();
      $result = $query
        ->fetchAssoc();
      if ($result) {

        // Copy all themes columns over to our block object, except the useless, theme-specific.
        foreach ($result as $column => $value) {
          if (!isset($block->{$column}) && !in_array($column, array(
            'bid',
            'theme',
          ))) {
            $block->{$column} = $value;
          }
        }
      }
      $block->region = 'none';
      return $block;
    }
  }
  return FALSE;
}