You are here

function nodesymlinks_item_process in NodeSymlinks 6

Same name and namespace in other branches
  1. 7 nodesymlinks.inc \nodesymlinks_item_process()

Load item defaults and process item before is saved

Parameters

item $item:

node $node:

1 call to nodesymlinks_item_process()
_nodesymlinks_nodeapi_insert_update in ./nodesymlinks.inc
Implementation of hook_nodeapi() OP: Insert & Update.

File

./nodesymlinks.inc, line 551

Code

function nodesymlinks_item_process(&$item, &$node) {

  // Load defaults
  $item += nodesymlinks_menu_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);
}