Created
November 23, 2016 13:09
-
-
Save rbk/98d38090e45252e797a12156fde4ff4c to your computer and use it in GitHub Desktop.
Here is a simple example to load up some nodes of type event for the month of March, looking up information of a field type datetime called 'field_date':
This file contains hidden or 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 | |
<?php | |
$query = new EntityFieldQuery(); | |
$entities = $query->entityCondition('entity_type', 'node') | |
->entityCondition('bundle', 'event') | |
->propertyCondition('status', 1) | |
->fieldCondition('field_date', 'value', array('2011-03-01', '2011-03-31'), 'BETWEEN') | |
->fieldOrderBy('field_date', 'value', 'ASC') | |
->execute(); | |
$nodes = node_load_multiple(array_keys($entities['node'])); | |
$views = node_view_multiple($nodes, 'teaser'); | |
$build['#nodes'] = $views['nodes']; | |
$build['#theme'] = 'whatever'; | |
return $build; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment