Advertisement
asanchez75

Drupal/EntityFieldQuery

May 23rd, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. https://github.com/timcosgrove/efq_example/blob/master/efq_example.module
  2. http://treehouseagency.com/blog/neil-hastings/2011/09/06/building-energygov-without-views
  3. $query = new EntityFieldQuery();
  4. $query->entityCondition('entity_type', 'node')
  5. ->entityCondition('bundle', 'simplenews')
  6. ->entityCondition('entity_id', array(13), '=')
  7. ->range(0, 1);
  8.  
  9. $result = $query->execute();
  10. if (isset($result['node'])) {
  11. $news_items_nids = array_keys($result['node']);
  12. $news_items = entity_load('node', $news_items_nids);
  13. }
  14. print_r($news_items);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement