function nodesymlinks_item_process in NodeSymlinks 7
Same name and namespace in other branches
- 6 nodesymlinks.inc \nodesymlinks_item_process()
Load item defaults and process item before is saved.
1 call to nodesymlinks_item_process()
- _nodesymlinks_nodeapi_insert_update in ./
nodesymlinks.inc - Implements hook_nodeapi() OP: Insert & Update.
File
- ./
nodesymlinks.inc, line 514 - Main NodeSymlinks callbacks
Code
function nodesymlinks_item_process(&$item, &$node) {
$item_defaults = array(
'link_title' => '',
'mlid' => 0,
'plid' => 0,
'menu_name' => 'navigation',
'weight' => 0,
'options' => array(),
'module' => 'nodesymlinks',
'expanded' => 0,
'hidden' => 0,
'has_children' => 0,
'customized' => 0,
);
// Load defaults.
$item += $item_defaults;
// Mark new item, $item[mlid]=0 is changed during menu_link_save, so
// it can't be used to marking.
$item['is_new'] = $item['mlid'] == 0 ? TRUE : FALSE;
if (!empty($item['parents'])) {
list($item['menu_name'], $item['plid']) = explode(':', $item['parents']);
}
if (!$item['customized']) {
$item['options']['attributes']['title'] = trim($node->title);
}
// @TODO: maybe we can remove this line, if we validate not empty title field
// and fill the field with the default value.
$item['link_title'] = trim($item['link_title']) ? trim($item['link_title']) : $node->title;
$item['link_path'] = nodesymlinks_create_item_path($item, $node);
}