function gallery_assist_rebuild_alias in Gallery Assist 6
2 calls to gallery_assist_rebuild_alias()
- gallery_assist_save in ./
gallery_assist.module - Implementation of hook_save().
- gallery_assist_save_one_submit in ./
gallery_assist.module
File
- ./
gallery_assist.module, line 1741 - Drupal content type with gallery functionality.
Code
function gallery_assist_rebuild_alias($item, $x = NULL) {
if ($item->ptitle != $item->old_ptitle) {
module_load_include('inc', 'pathauto', 'pathauto');
if ($item->aid > 0) {
$title = drupal_get_path_alias("node/{$item->nid}");
$ptitle = empty($item->ptitle) ? $item->pid : pathauto_cleanstring($item->ptitle);
$path = array(
'pid' => $item->aid,
'dst' => "{$title}/{$ptitle}-{$item->pid}",
'language' => $item->language,
'src' => "node/{$item->nid}/{$item->pid}",
);
drupal_write_record('url_alias', $path, 'pid');
}
else {
$title = drupal_get_path_alias("node/{$item->nid}");
$ptitle = empty($item->ptitle) ? $item->pid : pathauto_cleanstring($item->ptitle);
$path = array(
'dst' => "{$title}/{$ptitle}-{$item->pid}",
'language' => $item->language,
'src' => "node/{$item->nid}/{$item->pid}",
);
drupal_write_record('url_alias', $path);
$new_aid = db_last_insert_id($table, $field);
$gai = array(
'pid' => $r['pid'],
'aid' => $new_aid,
);
drupal_write_record('gallery_assist_item', $gai, 'pid');
}
}
}