function lingotek_save_url_alias in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.6 lingotek.remote.inc \lingotek_save_url_alias()
1 call to lingotek_save_url_alias()
File
- ./
lingotek.remote.inc, line 551
Code
function lingotek_save_url_alias($content, $node, $drupal_langcode) {
$target = check_plain($content);
//URL Alias related to the page:
$conditions = array(
'source' => 'node/' . $node->nid,
);
if ($node->language != LANGUAGE_NONE) {
$conditions['language'] = $node->language;
}
$path = path_load($conditions);
if ($path !== FALSE) {
$conditions['language'] = $drupal_langcode;
if ($path['alias'] != $target || $node->language != $drupal_langcode) {
$original = path_load($conditions);
$conditions['alias'] = $target;
if ($original === FALSE) {
path_save($conditions);
}
else {
path_delete($original);
path_save($conditions);
}
}
}
}