Get all nodes by type

Public

Get raw version
php
  1. //ex. for 'page'
  2. $query = new EntityFieldQuery();
  3. $query->entityCondition('entity_type', 'node')
  4. ->entityCondition('bundle', 'page')
  5. ->propertyCondition('status', 1); // published nodes
  6. $result = $query->execute();
  7. if (isset($result['node'])) {
  8. $nids = array_keys($result['node']);
  9. return node_load_multiple($nids);
  10. } else {
  11. return array();
  12. }