To fetch a type of entity you have to add the entity_type condition to it.
You have to fetch nodes, so the code for it will be as follows:
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
The entity condition is set using the function entityCondition in which you can set the entity type as node. Once if you have set the entity condition, you can execute the query. The node ids are returned in an array in the node key of the result. The complete code to display the nodes will be as follows:
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node');
$result = $query->execute();
$nodes = array();
if (isset($result['node'])) {
$nids = array_keys($result['node']);
$nodes = node_load_multiple($nids);
}
$list = array();
foreach ($nodes as $node) {
$options = array('absolute' => TRUE);
$url = url('node/' . $node->nid, $options);
$list[] = '<a href='.$url.'>'.$node->title.'</a>';
}
$theme_args = array('items' => $list, 'type' => 'ol');
$content = theme('item_list', $theme_args);
$block = array(
'subject' => t('A block to display results from entityquery'),
'content' => $content,
);
return $block;
Thank you.