| 89 |
function node_form_rearrange_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { |
function node_form_rearrange_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { |
| 90 |
switch ($op) { |
switch ($op) { |
| 91 |
case 'presave': |
case 'presave': |
| 92 |
$vocabularies = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' |
$types = variable_get('node_form_rearrange_content_types', array(0)); |
| 93 |
ORDER BY v.weight, v.name", 'v', 'vid'), $node->type); |
if(isset($types[$node->type]) && ($types[$node->type] != '0')) { |
| 94 |
//loop through vocabularies, resetting the original data arrangement (fields in taxonomy fieldset) so the taxonomy is saved |
$vocabularies = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' |
| 95 |
while ($vocabulary = db_fetch_object($vocabularies)) { |
ORDER BY v.weight, v.name", 'v', 'vid'), $node->type); |
| 96 |
$fieldname = 'taxonomy_field_'. $vocabulary->vid; |
//loop through vocabularies, resetting the original data arrangement (fields in taxonomy fieldset) so the taxonomy is saved |
| 97 |
if (isset($node->$fieldname) && $node->$fieldname) { |
while ($vocabulary = db_fetch_object($vocabularies)) { |
| 98 |
$node->taxonomy[$vocabulary->vid] = $node->$fieldname; |
$fieldname = 'taxonomy_field_'. $vocabulary->vid; |
| 99 |
unset($node->$fieldname); |
if (isset($node->$fieldname) && $node->$fieldname) { |
| 100 |
} |
$node->taxonomy[$vocabulary->vid] = $node->$fieldname; |
| 101 |
$fieldname = 'taxonomy_field_tags_'. $vocabulary->vid; |
unset($node->$fieldname); |
| 102 |
if (isset($node->$fieldname) && $node->$fieldname) { |
} |
| 103 |
$node->taxonomy['tags'][$vocabulary->vid] = $node->$fieldname; |
$fieldname = 'taxonomy_field_tags_'. $vocabulary->vid; |
| 104 |
unset($node->$fieldname); |
if (isset($node->$fieldname) && $node->$fieldname) { |
| 105 |
|
$node->taxonomy['tags'][$vocabulary->vid] = $node->$fieldname; |
| 106 |
|
unset($node->$fieldname); |
| 107 |
|
} |
| 108 |
} |
} |
| 109 |
} |
} |
| 110 |
break; |
break; |
| 116 |
*/ |
*/ |
| 117 |
|
|
| 118 |
function node_form_rearrange_content_extra_fields($type_name) { |
function node_form_rearrange_content_extra_fields($type_name) { |
| 119 |
$extra = array(); |
$types = variable_get('node_form_rearrange_content_types', array(0)); |
| 120 |
$vocabularies = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' |
if(isset($types[$type_name]) && ($types[$type_name] != '0')) { |
| 121 |
ORDER BY v.weight, v.name", 'v', 'vid'), $type_name); |
$extra = array(); |
| 122 |
//add rows for each vocabulary |
$vocabularies = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' |
| 123 |
while ($vocabulary = db_fetch_object($vocabularies)) { |
ORDER BY v.weight, v.name", 'v', 'vid'), $type_name); |
| 124 |
if ($vocabulary->tags) { |
//add rows for each vocabulary |
| 125 |
$extra["taxonomy_field_tags_$vocabulary->vid"] = array( |
while ($vocabulary = db_fetch_object($vocabularies)) { |
| 126 |
'label' => $vocabulary->name, |
if ($vocabulary->tags) { |
| 127 |
'description' => t('Individual field for %vocabularyname vocabulary, disables Taxonomy group ', array('%vocabularyname' => $vocabulary->name)), |
$extra["taxonomy_field_tags_$vocabulary->vid"] = array( |
|
'weight' => -5); |
|
|
} |
|
|
else { |
|
|
$extra["taxonomy_field_$vocabulary->vid"] = array( |
|
| 128 |
'label' => $vocabulary->name, |
'label' => $vocabulary->name, |
| 129 |
'description' => t('Individual field for %vocabularyname vocabulary, disables Taxonomy group', array('%vocabularyname' => $vocabulary->name)), |
'description' => t('Individual field for %vocabularyname vocabulary, disables Taxonomy group ', array('%vocabularyname' => $vocabulary->name)), |
| 130 |
'weight' => -5); |
'weight' => -5); |
| 131 |
|
} |
| 132 |
|
else { |
| 133 |
|
$extra["taxonomy_field_$vocabulary->vid"] = array( |
| 134 |
|
'label' => $vocabulary->name, |
| 135 |
|
'description' => t('Individual field for %vocabularyname vocabulary, disables Taxonomy group', array('%vocabularyname' => $vocabulary->name)), |
| 136 |
|
'weight' => -5); |
| 137 |
|
} |
| 138 |
} |
} |
| 139 |
} |
} |
| 140 |
return $extra; |
return $extra; |
| 141 |
} |
} |
| 142 |
|
|