--- /Users/hbf/icar/checkout/vendor/drupal-contrib/modules/relativity/current/relativity.module 2007-03-30 00:10:28.000000000 +0200 +++ relativity.module 2007-03-30 00:06:55.000000000 +0200 @@ -581,6 +581,16 @@ '#description' => t('Use the specified relativity query to identify possible children.'), ); } + + $group['node_'.$type.'_options']['relativity_linkops_in_edit_form_'.$type] = array( + '#type' => 'checkbox', + '#title' => t('Show Link Operations in Node\'s Edit Form'), + '#return_value' => 1, + '#default_value' => variable_get('relativity_linkops_in_edit_form_'.$type, FALSE), + '#description' => t('Display the Link operations in the node\'s Edit tab (at node/34/edit, for example) or in the node\'s View tab (at node/34, for example).'), + '#weight' => 20 + ); + } } } @@ -1104,7 +1114,8 @@ } // output links to attach allowed children types and remove existing children - if ($childrentypes = variable_get('relativity_type_'. $node->type, FALSE)) { + if (!variable_get('relativity_linkops_in_edit_form_'. $node->type, FALSE) && + $childrentypes = variable_get('relativity_type_'. $node->type, FALSE)) { $node->content['relativity_operations'] = array( '#value' => theme('relativity_show_link_operations', $childrentypes, $node, 'view'), '#weight' => 20, @@ -1115,6 +1126,24 @@ } /** + * Implementation of hook_nodeapi(). + * + * This is needed only in the case when the module settings indicate that the + * "Link operations" are to be shown in the Edit tab of the node. + */ +function relativity_form_alter($form_id, &$form) { + if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) { + $node = $form['#node']; + if (variable_get('relativity_linkops_in_edit_form_'. $node->type, FALSE) && + $childrentypes = variable_get('relativity_type_'. $node->type, FALSE)) { + $form['relativity'] = array( + '#value' => theme('relativity_show_link_operations', $childrentypes, $node, 'view'), + ); + } + } +} + +/** * Sorts an array of node types based on admin specification * @param an array of node type names to sort or empty to use precomputed $sorted_node_list * @return an array of sorted node type names, unindexed