You are here

function node_import_check_node_by_path in Node import 6

Check a node by path alias.

Related topics

1 string reference to 'node_import_check_node_by_path'
path_node_import_fields_alter in supported/path.inc
Implementation of hook_node_import_fields_alter().

File

supported/path.inc, line 44
Support file for the path core module.

Code

function node_import_check_node_by_path(&$value, $field, $options, $preview) {

  // Value is either a path ("path/to/page") or an array (array("path", "to", "page")).
  $url = is_array($value) ? implode('/', $value) : $value;
  if ($result = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND src LIKE 'node/%'", $url))) {
    $value = substr($result, strlen('node/'));

    //TODO: what if an alias like 'node/XXX/...'
    return TRUE;
  }
}