public static function Nodes::getNodeFromPath in Hook Update Deploy Tools 7
Loads a node from a path.
Parameters
string $path: The path of the node to import/update.
string $language: The langage of the alias to look up (node->language).
Return value
mixed (object) Node from that path. (bool) FALSE if there is no node to load from that path.
1 call to Nodes::getNodeFromPath()
- Nodes::processOne in src/
Nodes.php - Validated Updates/Imports one page from the contents of an import file.
File
- src/
Nodes.php, line 388
Class
- Nodes
- Public method for changing nodes programatically.
Namespace
HookUpdateDeployToolsCode
public static function getNodeFromPath($path, $language) {
$node = FALSE;
$source_path = drupal_lookup_path('source', $path, $language);
$source_path_parts = explode('/', $source_path);
if (!empty($source_path_parts[0]) && $source_path_parts[0] === 'node' && !empty($source_path_parts[1])) {
$nid = $source_path_parts[1];
$nodes = entity_load('node', array(
$nid,
));
$node = $nodes[$nid];
}
return $node;
}