I am trying to get all nodes of a certian type from drupal. I have tried many ways to achieve that, but maybe due to my lack of Drupal custom module programming experience I couldn't achieve my desire. the closest way that I found on the web, is this:
$nids = \Drupal::entityQuery('node')->condition('type','news')->execute(); $nodes = \Drupal ode\Entity\Node::loadMultiple($nids);
- the first line returns an object of id's
- the second line returns the nodes of those id's
this looks easy and straight forward. but, this is the output!
can someone please help, what is wrong? and is this the correct way to do it ?
I want to take the nodes then search every one of them ( I am making some sort of search engine) so I expect some kind of an object that I can then extract the heading, body ... etc, from. is this the correct way ?