Commit aef264df authored by Gábor Hojtsy's avatar Gábor Hojtsy

#192887 by webernet: fix notice displayed on node form, when node has no taxonomy property

parent 98eefd9f
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment