summaryrefslogtreecommitdiff
path: root/modules/rdf
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-07-14 20:26:52 +0000
committerDries Buytaert <dries@buytaert.net>2010-07-14 20:26:52 +0000
commit0bbdf9579dd17501fadb1a43df5432228999fb8a (patch)
tree94d0b4b46096cae9bd82c8acefe7c9f02e37470d /modules/rdf
parent1798cf27abe827385ee0cb76ae55304ee1ad4a13 (diff)
downloadbrdo-0bbdf9579dd17501fadb1a43df5432228999fb8a.tar.gz
brdo-0bbdf9579dd17501fadb1a43df5432228999fb8a.tar.bz2
- Patch #826028 by bjaspan: taxonomy form validation creates new terms.
Diffstat (limited to 'modules/rdf')
-rw-r--r--modules/rdf/rdf.module17
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'];
+ }
}
}
}