$nodes = node_load_multiple(NULL, array("title" => "Foo Bar")); to fetch nodes by titles. But after going through Drupal security standards,
node_load_multiple is not the right way to load all nodes.
node_load_multiple() will load ALL nodes regardless of access, so that must not be used here.
Solution suggestion is:
Use an entity query instead. "When adding a node listing to your module, be sure to use an entity query, which will add a tag of "node_access". This will allow modules dealing with node access to ensure only nodes to which the user has access are retrieved"
But I'm not sure how to apply above statement programmaticly?
Is below query the right way that solves security issues?
\Drupal\node\Entity\Node::loadMultiple(NULL, array("title" => "Foo Bar"));
If not, please suggest an appropriate alternate of loading nodes by title that respects node access grants.