You are here

function entity_block_block_view in Entity Blocks 7

Implements hook_block_view().

File

./entity_block.module, line 231
Display entities (via view modes) as fieldable blocks.

Code

function entity_block_block_view($delta = '') {

  // Load the entity block and target entity.
  $entity_block = entity_block_load_single($delta);
  $target_entity = entity_load_single($entity_block->target_entity_type, $entity_block->target_entity_id);

  // Build the block array.
  $block = array();
  $block['subject'] = $entity_block->title;
  $block['content'] = entity_view($entity_block->target_entity_type, array(
    $target_entity,
  ), $entity_block->target_view_mode);
  return $block;
}