Created
September 3, 2015 12:04
-
-
Save rachellawson/4b103fab4d960078303c to your computer and use it in GitHub Desktop.
loading and displaying a bunch of entities - see http://drupal.stackexchange.com/questions/103608/what-does-the-entity-view-function-do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node'); | |
$query->entityCondition('bundle', 'article'); | |
$result = $query->execute(); | |
if (!empty($result)) { | |
$entities = entity_load('node', array_keys($result['node'])); | |
return entity_view('node', $entities, 'full'); | |
} else { | |
return array('#markup' => t('No article nodes found.')); | |
} | |
// wish I could remember this off by heart!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment