| 107 |
$field = $current_node->referrers[arg(3)]['referrence'][arg(4)][arg(5)]['field_name']; |
$field = $current_node->referrers[arg(3)]['referrence'][arg(4)][arg(5)]['field_name']; |
| 108 |
array_push($append_node->$field, array('nid' => $current_node->nid)); |
array_push($append_node->$field, array('nid' => $current_node->nid)); |
| 109 |
|
|
| 110 |
|
// Save, and ensure the changes are noticed |
| 111 |
node_save($append_node); |
node_save($append_node); |
| 112 |
|
cache_clear_all(); |
| 113 |
|
|
| 114 |
drupal_set_message(t('The node was added')); |
drupal_set_message(t('The node was added')); |
| 115 |
drupal_goto('node/'.arg(1)); |
drupal_goto('node/'.arg(1)); |
| 116 |
} |
} |
| 118 |
/** |
/** |
| 119 |
* Auto complete function for the form to add to an existing node |
* Auto complete function for the form to add to an existing node |
| 120 |
*/ |
*/ |
| 121 |
function _nodereferrer_create_autocomplete($type) { |
function _nodereferrer_create_autocomplete($type, $filter) { |
| 122 |
$matches = array(); |
$matches = array(); |
| 123 |
|
|
| 124 |
$res = db_query("SELECT nid FROM {node} WHERE type='%s'", $type); |
$res = db_query("SELECT nid FROM {node} WHERE type='%s' AND title LIKE '%%%s%%'", $type, $filter); |
| 125 |
while ($nid = db_fetch_object($res)) { |
while ($nid = db_fetch_object($res)) { |
| 126 |
$node = node_load($nid->nid); |
$node = node_load($nid->nid); |
| 127 |
$matches[$node->title.' [nid:'.$node->nid.']'] = $node->title; |
$matches[$node->title.' [nid:'.$node->nid.']'] = $node->title; |