Loading an Entity by its Title

How to load an entity via its title – or other field conditions

$query = new EntityFieldQuery();
$query -> entityCondition('entity_type', 'node') -> propertyCondition('type', 'help_fact') -> propertyCondition('title', $token);
$result = $query -> execute();

This will give a set of NID’s


$nodes = node_load_multiple(NULL, array('title' => $token));

will load the whole node.

To grab the first

$node = array_shift($nodes);


Leave a comment

Your email address will not be published. Required fields are marked *