summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-22 13:18:01 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-22 13:18:01 +0000
commitaef264dfb64de218a84f5ecff32d6423a53f02eb (patch)
treec0fb9e2ad5dc3a8eb6bc50796e7d183d07a4736a
parent98eefd9f0c42a33718a60ee43f55159a7edd0b0d (diff)
downloadbrdo-aef264dfb64de218a84f5ecff32d6423a53f02eb.tar.gz
brdo-aef264dfb64de218a84f5ecff32d6423a53f02eb.tar.bz2
#192887 by webernet: fix notice displayed on node form, when node has no taxonomy property
-rw-r--r--modules/taxonomy/taxonomy.module34
1 files changed, 18 insertions, 16 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index a3ec72cbe..1b8e7e10d 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -513,24 +513,26 @@ function taxonomy_form_alter(&$form, $form_state, $form_id) {
*/
function taxonomy_preview_terms($node) {
$taxonomy = array();
- foreach ($node->taxonomy as $key => $term) {
- unset($node->taxonomy[$key]);
- // A 'Multiple select' and a 'Free tagging' field returns an array.
- if (is_array($term)) {
- foreach ($term as $tid) {
- if ($key == 'tags') {
- // Free tagging; the values will be saved for later as strings
- // instead of objects to fill the form again.
- $taxonomy['tags'] = $term;
- }
- else {
- $taxonomy[$tid] = taxonomy_get_term($tid);
+ if (isset($node->taxonomy)) {
+ foreach ($node->taxonomy as $key => $term) {
+ unset($node->taxonomy[$key]);
+ // A 'Multiple select' and a 'Free tagging' field returns an array.
+ if (is_array($term)) {
+ foreach ($term as $tid) {
+ if ($key == 'tags') {
+ // Free tagging; the values will be saved for later as strings
+ // instead of objects to fill the form again.
+ $taxonomy['tags'] = $term;
+ }
+ else {
+ $taxonomy[$tid] = taxonomy_get_term($tid);
+ }
}
}
- }
- // A 'Single select' field returns the term id.
- elseif ($term) {
- $taxonomy[$term] = taxonomy_get_term($term);
+ // A 'Single select' field returns the term id.
+ elseif ($term) {
+ $taxonomy[$term] = taxonomy_get_term($term);
+ }
}
}
return $taxonomy;