diff options
Diffstat (limited to 'modules/rdf/rdf.module')
-rw-r--r-- | modules/rdf/rdf.module | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module index 968b1678a..6c341b8d7 100644 --- a/modules/rdf/rdf.module +++ b/modules/rdf/rdf.module @@ -727,12 +727,17 @@ function rdf_field_attach_view_alter(&$output, $context) { $element = &$output[$field_name]; if ($element['#field_type'] == 'taxonomy_term_reference' && $element['#formatter'] == 'taxonomy_term_reference_link') { foreach ($element['#items'] as $delta => $item) { - $term = $item['taxonomy_term']; - if (!empty($term->rdf_mapping['rdftype'])) { - $element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype']; - } - if (!empty($term->rdf_mapping['name']['predicates'])) { - $element[$delta]['#options']['attributes']['property'] = $term->rdf_mapping['name']['predicates']; + // This function is invoked during entity preview when + // taxonomy term reference items might contain free-tagging + // terms that do not exist yet and thus have no $item['taxonomy_term']. + if (isset($item['taxonomy_term'])) { + $term = $item['taxonomy_term']; + if (!empty($term->rdf_mapping['rdftype'])) { + $element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype']; + } + if (!empty($term->rdf_mapping['name']['predicates'])) { + $element[$delta]['#options']['attributes']['property'] = $term->rdf_mapping['name']['predicates']; + } } } } |