You are here

function entity_block_list in Entity Blocks 7

Page callback for manage path.

Return value

array

1 string reference to 'entity_block_list'
entity_block_menu in ./entity_block.module
Implements hook_menu().

File

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

Code

function entity_block_list() {
  $content = array();
  $entities = entity_block_load_multiple();
  if (!empty($entities)) {
    foreach ($entities as $entity) {
      $wrapper = entity_metadata_wrapper('entity_block', $entity);
      $rows[] = array(
        'data' => array(
          'id' => $entity->entity_block_id,
          'title' => $entity->title,
          'target_entity_type' => $entity->target_entity_type,
          'target_bundle' => $entity->target_bundle,
          'target_view_mode' => $entity->target_view_mode,
          'target_entity_id' => $entity->target_entity_id,
          'edit' => l(t('Edit'), 'admin/structure/entity-blocks/' . $entity->entity_block_id . '/edit'),
        ),
      );
    }
    $content['entity_table'] = array(
      '#theme' => 'table',
      '#rows' => $rows,
      '#header' => array(
        t('ID'),
        t('Title'),
        t('Type'),
        t('Bundle'),
        t('View mode'),
        t('Entity'),
        t('Edit'),
      ),
    );
  }
  else {
    $content[] = array(
      '#type' => 'item',
      '#markup' => t('No entity blocks created.'),
    );
  }
  return $content;
}