| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: add_reference.php,v 1.1.2.2 2008/09/09 11:11:13 anselmheaton Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_menu() for the add to referrer page |
* Implementation of hook_menu() for the add to referrer page |
| 101 |
if ($form_state['clicked_button']['#name'] != 'add') { |
if ($form_state['clicked_button']['#name'] != 'add') { |
| 102 |
drupal_set_message(t('The operation was cancelled')); |
drupal_set_message(t('The operation was cancelled')); |
| 103 |
drupal_goto('node/'.arg(1)); |
drupal_goto('node/'.arg(1)); |
| 104 |
|
return; |
| 105 |
} |
} |
| 106 |
|
|
| 107 |
$append_node = node_load($form_state['values']['referrence']); |
$append_node = node_load($form_state['values']['referrence']); |
| 108 |
$current_node = node_load(arg(1)); |
$current_node = node_load(arg(1)); |
| 109 |
|
|
| 110 |
|
// Make sure the user is allowed to do this. |
| 111 |
|
if (!node_access('update', $current_node)) { |
| 112 |
|
drupal_set_message(t('You do not have rights to update this node')); |
| 113 |
|
drupal_goto('node/'.arg(1)); |
| 114 |
|
return; |
| 115 |
|
} |
| 116 |
|
|
| 117 |
$field_name = $current_node->reference_fields[arg(3)]['field_name']; |
$field_name = $current_node->reference_fields[arg(3)]['field_name']; |
| 118 |
|
|
| 119 |
$field_array =& $current_node->$field_name; |
$field_array =& $current_node->$field_name; |