diff --git a/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php b/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php index eef17a5..d9f369f 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php +++ b/core/modules/rdf/lib/Drupal/rdf/Plugin/Core/Entity/RdfMapping.php @@ -76,7 +76,7 @@ class RdfMapping extends ConfigEntityBase implements RdfMappingInterface { /** * {@inheritdoc} */ - public function getBundleMapping() { + public function getPreparedBundleMapping() { $types = array(); if (isset($this->types)) { $types = $this->types; @@ -87,7 +87,7 @@ public function getBundleMapping() { /** * {@inheritdoc} */ - public function getBundleMappingConfig() { + public function getBundleMapping() { if (isset($this->types)) { return array('types' => $this->types); } @@ -97,7 +97,7 @@ public function getBundleMappingConfig() { /** * {@inheritdoc} */ - public function setBundleMappingConfig(array $mapping) { + public function setBundleMapping(array $mapping) { if (isset($mapping['types'])) { $this->types = $mapping['types']; } @@ -108,7 +108,7 @@ public function setBundleMappingConfig(array $mapping) { /** * {@inheritdoc} */ - public function getFieldMapping($field_name) { + public function getPreparedFieldMapping($field_name) { $field_mapping = array( 'properties' => NULL, 'datatype' => NULL, @@ -124,7 +124,7 @@ public function getFieldMapping($field_name) { /** * {@inheritdoc} */ - public function getFieldMappingConfig($field_name) { + public function getFieldMapping($field_name) { if (isset($this->fieldMappings[$field_name])) { return $this->fieldMappings[$field_name]; } @@ -134,7 +134,7 @@ public function getFieldMappingConfig($field_name) { /** * {@inheritdoc} */ - public function setFieldMappingConfig($field_name, array $mapping = array()) { + public function setFieldMapping($field_name, array $mapping = array()) { $this->fieldMappings[$field_name] = $mapping; return $this; } diff --git a/core/modules/rdf/lib/Drupal/rdf/RdfMappingInterface.php b/core/modules/rdf/lib/Drupal/rdf/RdfMappingInterface.php index 21ab065..19b1e13 100644 --- a/core/modules/rdf/lib/Drupal/rdf/RdfMappingInterface.php +++ b/core/modules/rdf/lib/Drupal/rdf/RdfMappingInterface.php @@ -16,30 +16,40 @@ /** * Gets the mapping for the bundle-level data. * + * The prepared bundle mapping should be used when outputting data in RDF + * serializations such as RDFa. In the prepared mapping, the mapping + * configuration's CURIE arrays are processed into CURIE strings suitable for + * output. + * * @return array * The bundle mapping. */ - public function getBundleMapping(); + public function getPreparedBundleMapping(); /** * Gets the mapping config for the bundle-level data. * + * This function returns the bundle mapping as stored in config, which may + * contain CURIE arrays. If the mapping is needed for output in a + * serialization format, such as RDFa, then getPreparedBundleMapping() should + * be used instead. + * * @return array|null * The bundle mapping, or NULL if there is no mapping. */ - public function getBundleMappingConfig(); + public function getBundleMapping(); /** - * Sets the mapping config for a bundle. + * Sets the mapping config for the bundle-level data. * * This only sets bundle-level mappings, such as the RDF type. Mappings for - * a bundle's fields should be handled with setFieldMappingConfig. + * a bundle's fields should be handled with setFieldMapping. * * Example usage: * -Map the 'article' bundle to 'sioc:Post'. * @code * rdf_get_mapping('node', 'article') - * ->setBundleMappingConfig(array( + * ->setBundleMapping(array( * 'types' => array('sioc:Post'), * )) * ->save(); @@ -51,10 +61,15 @@ public function getBundleMappingConfig(); * @return \Drupal\rdf\Plugin\Core\Entity\RdfMapping * The RdfMapping object. */ - public function setBundleMappingConfig(array $mapping); + public function setBundleMapping(array $mapping); /** - * Gets the prepared mapping for a field on the bundle. + * Gets the prepared mapping for a field. + * + * The prepared field mapping should be used when outputting data in RDF + * serializations such as RDFa. In the prepared mapping, the mapping + * configuration's CURIE arrays are processed into CURIE strings suitable for + * output. * * @param string $field_name * The name of the field. @@ -62,10 +77,15 @@ public function setBundleMappingConfig(array $mapping); * @return array * The prepared field mapping. */ - public function getFieldMapping($field_name); + public function getPreparedFieldMapping($field_name); /** - * Gets the mapping config for a field on the bundle. + * Gets the mapping config for a field. + * + * This function returns the field mapping as stored in config, which may + * contain CURIE arrays. If the mapping is needed for output in a + * serialization format, such as RDFa, then getPreparedFieldMapping() should + * be used instead. * * @param string $field_name * The name of the field. @@ -73,10 +93,10 @@ public function getFieldMapping($field_name); * @return array|null * The field mapping config array, or NULL if there is no mapping. */ - public function getFieldMappingConfig($field_name); + public function getFieldMapping($field_name); /** - * Sets the mapping configuration for a field. + * Sets the mapping config for a field. * * @param string $field_name * The name of the field. @@ -86,5 +106,5 @@ public function getFieldMappingConfig($field_name); * @return \Drupal\rdf\Plugin\Core\Entity\RdfMapping * The RdfMapping object. */ - public function setFieldMappingConfig($field_name, array $mapping = array()); + public function setFieldMapping($field_name, array $mapping = array()); } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php index d366010..8c6319a 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php @@ -55,19 +55,19 @@ public function setUp() { 'properties' => array('sioc:num_replies'), 'datatype' => 'xsd:integer', ); - $article_mapping->setFieldMappingConfig('comment_count', $comment_count_mapping)->save(); + $article_mapping->setFieldMapping('comment_count', $comment_count_mapping)->save(); // Save user mapping. $user_mapping = rdf_get_mapping('user', 'user'); $username_mapping = array( 'properties' => array('foaf:name'), ); - $user_mapping->setFieldMappingConfig('name', $username_mapping)->save(); - $user_mapping->setFieldMappingConfig('homepage', array('properties' => array('foaf:page'), 'mapping_type' => 'rel'))->save(); + $user_mapping->setFieldMapping('name', $username_mapping)->save(); + $user_mapping->setFieldMapping('homepage', array('properties' => array('foaf:page'), 'mapping_type' => 'rel'))->save(); // Save comment mapping. $mapping = rdf_get_mapping('comment', 'comment_node_article'); - $mapping->setBundleMappingConfig(array('types' => array('sioc:Post', 'sioct:Comment')))->save(); + $mapping->setBundleMapping(array('types' => array('sioc:Post', 'sioct:Comment')))->save(); $field_mappings = array( 'title' => array( 'properties' => array('dc:title'), @@ -99,7 +99,7 @@ public function setUp() { ); // Iterate over shared field mappings and save. foreach ($field_mappings as $field_name => $field_mapping) { - $mapping->setFieldMappingConfig($field_name, $field_mapping)->save(); + $mapping->setFieldMapping($field_name, $field_mapping)->save(); } } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CrudTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CrudTest.php index 31016d3..06f5d68 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/CrudTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CrudTest.php @@ -55,19 +55,19 @@ function testBundleMapping() { // Test that the bundle mapping can be saved. $types = array('sioc:Post', 'foaf:Document'); rdf_get_mapping($this->entity_type, $this->bundle) - ->setBundleMappingConfig(array('types' => $types)) + ->setBundleMapping(array('types' => $types)) ->save(); $bundle_mapping = rdf_get_mapping($this->entity_type, $this->bundle) - ->getBundleMappingConfig(); + ->getBundleMapping(); $this->assertEqual($types, $bundle_mapping['types'], 'Bundle mapping saved.'); // Test that the bundle mapping can be edited. $types = array('schema:BlogPosting'); rdf_get_mapping($this->entity_type, $this->bundle) - ->setBundleMappingConfig(array('types' => $types)) + ->setBundleMapping(array('types' => $types)) ->save(); $bundle_mapping = rdf_get_mapping($this->entity_type, $this->bundle) - ->getBundleMappingConfig(); + ->getBundleMapping(); $this->assertEqual($types, $bundle_mapping['types'], 'Bundle mapping updated.'); } @@ -84,10 +84,10 @@ function testFieldMapping() { 'datatype_callback' => 'date_iso8601', ); rdf_get_mapping($this->entity_type, $this->bundle) - ->setFieldMappingConfig($field_name, $mapping) + ->setFieldMapping($field_name, $mapping) ->save(); $field_mapping = rdf_get_mapping($this->entity_type, $this->bundle) - ->getFieldMappingConfig($field_name); + ->getFieldMapping($field_name); $this->assertEqual($mapping, $field_mapping, 'Field mapping saved.'); // Test that the field mapping can be edited. @@ -97,10 +97,10 @@ function testFieldMapping() { 'datatype_callback' => 'date_iso8601', ); rdf_get_mapping($this->entity_type, $this->bundle) - ->setFieldMappingConfig($field_name, $mapping) + ->setFieldMapping($field_name, $mapping) ->save(); $field_mapping = rdf_get_mapping($this->entity_type, $this->bundle) - ->getFieldMappingConfig($field_name); + ->getFieldMapping($field_name); $this->assertEqual($mapping, $field_mapping, 'Field mapping updated.'); } } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php index 42a08b8..fda17aa 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/FileFieldAttributesTest.php @@ -44,7 +44,7 @@ public function setUp() { // Set the RDF mapping for the new field. $mapping = rdf_get_mapping('node', 'article'); - $mapping->setFieldMappingConfig($this->fieldName, array('properties' => array('rdfs:seeAlso'), 'mapping_type' => 'rel'))->save(); + $mapping->setFieldMapping($this->fieldName, array('properties' => array('rdfs:seeAlso'), 'mapping_type' => 'rel'))->save(); $test_file = $this->getTestFile('text'); diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php index 20c028a..f57e4cb 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/ImageFieldAttributesTest.php @@ -41,7 +41,7 @@ public function setUp() { // Set the RDF mapping for the new field. rdf_get_mapping('node', 'article') - ->setFieldMappingConfig($this->fieldName, array( + ->setFieldMapping($this->fieldName, array( 'properties' => array('og:image'), 'mapping_type' => 'rel', )) diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php index 150d736..bf18a63 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/NodeAttributesTest.php @@ -33,13 +33,13 @@ public function setUp() { parent::setUp(); rdf_get_mapping('node', 'article') - ->setBundleMappingConfig(array( + ->setBundleMapping(array( 'types' => array('sioc:Item', 'foaf:Document'), )) - ->setFieldMappingConfig('title', array( + ->setFieldMapping('title', array( 'properties' => array('dc:title'), )) - ->setFieldMappingConfig('created', array( + ->setFieldMapping('created', array( 'properties' => array('dc:date', 'dc:created'), 'datatype' => 'xsd:dateTime', 'datatype_callback' => 'date_iso8601', diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php index ac054ca..0474519 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfMappingUpgradePathTest.php @@ -51,21 +51,21 @@ protected function _testUnalteredMappingUpgrade() { $config = rdf_get_mapping('node', 'page'); // Test bundle mapping. - $mapping = $config->getBundleMappingConfig(); + $mapping = $config->getBundleMapping(); $expected_mapping = array( 'types' => array('foaf:Document'), ); $this->assertEqual($mapping, $expected_mapping, 'Unaltered bundle mapping upgraded correctly.'); // Test field mapping - property. - $mapping = $config->getFieldMappingConfig('title'); + $mapping = $config->getFieldMapping('title'); $expected_mapping = array( 'properties' => array('dc:title'), ); $this->assertEqual($mapping, $expected_mapping, 'Unaltered field mapping upgraded correctly.'); // Test field mapping - property with datatype and callback. - $mapping = $config->getFieldMappingConfig('created'); + $mapping = $config->getFieldMapping('created'); $expected_mapping = array( 'properties' => array('dc:date', 'dc:created'), 'datatype' => 'xsd:dateTime', @@ -74,7 +74,7 @@ protected function _testUnalteredMappingUpgrade() { $this->assertEqual($mapping, $expected_mapping, 'Unaltered field mapping with datatype and datatype callback upgraded correctly.'); // Test field mapping - rel. - $mapping = $config->getFieldMappingConfig('uid'); + $mapping = $config->getFieldMapping('uid'); $expected_mapping = array( 'properties' => array('sioc:has_creator'), 'mapping_type' => 'rel', @@ -89,21 +89,21 @@ protected function _testAlteredMappingUpgrade() { $config = rdf_get_mapping('node', 'article'); // Test bundle mapping. - $mapping = $config->getBundleMappingConfig(); + $mapping = $config->getBundleMapping(); $expected_mapping = array( 'types' => array('foo:Type'), ); $this->assertEqual($mapping, $expected_mapping, 'Overriden bundle mapping upgraded correctly.'); // Test field mapping. - $mapping = $config->getFieldMappingConfig('field_image'); + $mapping = $config->getFieldMapping('field_image'); $expected_mapping = array( 'properties' => array('foo:image'), ); $this->assertEqual($expected_mapping, $mapping, 'Overriden field mapping is upgraded correctly.'); // Test field mapping. - $mapping = $config->getFieldMappingConfig('changed'); + $mapping = $config->getFieldMapping('changed'); $expected_mapping = array(); $this->assertEqual($expected_mapping, $mapping, 'Empty field mapping from overriden mapping is upgraded correctly.'); } @@ -114,7 +114,7 @@ protected function _testAlteredMappingUpgrade() { protected function _testReverseRelationUpgrade() { // Test field mapping - rev. $config = rdf_get_mapping('node', 'rev_test'); - $mapping = $config->getFieldMappingConfig('field_rev'); + $mapping = $config->getFieldMapping('field_rev'); $expected_mapping = array(); $this->assertEqual($mapping, $expected_mapping, 'Reverse relation mapping has been dropped.'); } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php index 9f3672d..314a4eb 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/RdfaAttributesTest.php @@ -113,7 +113,7 @@ protected function _testAttributes($expected_attributes, $field_mapping, $data = $this->saveMapping($field_mapping); $mapping = rdf_get_mapping('node', 'article') - ->getFieldMapping('field_test'); + ->getPreparedFieldMapping('field_test'); $attributes = rdf_rdfa_attributes($mapping, $data); ksort($expected_attributes); ksort($attributes); @@ -128,7 +128,7 @@ protected function _testAttributes($expected_attributes, $field_mapping, $data = */ protected function saveMapping($field_mapping) { rdf_get_mapping('node', 'article') - ->setFieldMappingConfig('field_test', $field_mapping) + ->setFieldMapping('field_test', $field_mapping) ->save(); } } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php index fb952f3..99390d3 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php @@ -36,8 +36,8 @@ function setUp() { // RDF mapping - term bundle. rdf_get_mapping('taxonomy_term', $this->vocabulary->id()) - ->setBundleMappingConfig(array('types' => array('skos:Concept'))) - ->setFieldMappingConfig('name', array( + ->setBundleMapping(array('types' => array('skos:Concept'))) + ->setFieldMapping('name', array( 'properties' => array('rdfs:label', 'skos:prefLabel'), )) ->save(); diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyTermFieldAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyTermFieldAttributesTest.php index 9ad0ec0..0c7c0cb 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyTermFieldAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyTermFieldAttributesTest.php @@ -46,15 +46,15 @@ public function setUp() { // Set the RDF mapping for the new field. rdf_get_mapping('node', 'article') - ->setFieldMappingConfig($this->fieldName, array( + ->setFieldMapping($this->fieldName, array( 'properties' => array('dc:subject'), 'mapping_type' => 'rel', )) ->save(); rdf_get_mapping('taxonomy_term', $this->vocabulary->id()) - ->setBundleMappingConfig(array('types' => array('skos:Concept'))) - ->setFieldMappingConfig('name', array('properties' => array('rdfs:label'))) + ->setBundleMapping(array('types' => array('skos:Concept'))) + ->setFieldMapping('name', array('properties' => array('rdfs:label'))) ->save(); } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php index 2fdbce8..d2d1cdd 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/TrackerAttributesTest.php @@ -76,7 +76,7 @@ function setUp() { ); // Iterate over field mappings and save. foreach ($node_shared_field_mappings as $field_name => $field_mapping) { - $mapping->setFieldMappingConfig($field_name, $field_mapping)->save(); + $mapping->setFieldMapping($field_name, $field_mapping)->save(); } // Enables anonymous posting of content. diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php index 6944c34..8de5927 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php @@ -32,10 +32,10 @@ public static function getInfo() { public function setUp() { parent::setUp(); rdf_get_mapping('user', 'user') - ->setBundleMappingConfig(array( + ->setBundleMapping(array( 'types' => array('sioc:UserAccount'), )) - ->setFieldMappingConfig('name', array( + ->setFieldMapping('name', array( 'properties' => array('foaf:name'), )) ->save(); diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 1dccf02..07edb4e 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -50,10 +50,10 @@ function rdf_help($path, $arg) { * -Map the 'article' bundle to 'sioc:Post' and the 'title' field to 'dc:title'. * @code * rdf_get_mapping('node', 'article') - * ->setBundleMappingConfig(array( + * ->setBundleMapping(array( * 'types' => array('sioc:Post'), * )) - * ->setFieldMappingConfig('title', array( + * ->setFieldMapping('title', array( * 'properties' => array('dc:title') * )) * ->save(); @@ -201,7 +201,7 @@ function rdf_comment_load($comments) { // isn't needed until rdf_preprocess_comment() is called, but set it here // to optimize performance for websites that implement an entity cache. $created_mapping = rdf_get_mapping('comment', $comment->bundle()) - ->getFieldMapping('created'); + ->getPreparedFieldMapping('created'); $comment->rdf_data['date'] = rdf_rdfa_attributes($created_mapping, $comment->created->value); $comment->rdf_data['nid_uri'] = url('node/' . $comment->nid->target_id); if ($comment->pid->target_id) { @@ -287,7 +287,7 @@ function rdf_preprocess_node(&$variables) { // on.) $bundle = $variables['node']->bundle(); $mapping = rdf_get_mapping('node', $bundle); - $bundle_mapping = $mapping->getBundleMapping('node', $bundle); + $bundle_mapping = $mapping->getPreparedBundleMapping('node', $bundle); $variables['attributes']['about'] = empty($variables['node_url']) ? NULL: $variables['node_url']; $variables['attributes']['typeof'] = empty($bundle_mapping['types']) ? NULL : $bundle_mapping['types']; @@ -295,7 +295,7 @@ function rdf_preprocess_node(&$variables) { // added to the

tag which might contain HTML code, we specify an empty // datatype to ensure the value of the title read by the RDFa parsers is a // literal. - $title_mapping = $mapping->getFieldMapping('title'); + $title_mapping = $mapping->getPreparedFieldMapping('title'); $variables['title_attributes']['property'] = empty($title_mapping['properties']) ? NULL : $title_mapping['properties']; $variables['title_attributes']['datatype'] = ''; @@ -316,7 +316,7 @@ function rdf_preprocess_node(&$variables) { } // Adds RDFa markup for the date. - $created_mapping = $mapping->getFieldMapping('created'); + $created_mapping = $mapping->getPreparedFieldMapping('created'); if (!empty($created_mapping)) { $date_attributes = rdf_rdfa_attributes($created_mapping, $variables['node']->created); $variables['rdf_template_variable_attributes']['date'] = $date_attributes; @@ -325,7 +325,7 @@ function rdf_preprocess_node(&$variables) { } } // Adds RDFa markup for the relation between the node and its author. - $uid_mapping = $mapping->getFieldMapping('uid'); + $uid_mapping = $mapping->getPreparedFieldMapping('uid'); if (!empty($uid_mapping)) { $variables['rdf_template_variable_attributes']['name']['rel'] = $uid_mapping['properties']; if ($variables['submitted']) { @@ -334,7 +334,7 @@ function rdf_preprocess_node(&$variables) { } // Adds RDFa markup annotating the number of comments a node has. - $comment_count_mapping = $mapping->getFieldMapping('comment_count'); + $comment_count_mapping = $mapping->getPreparedFieldMapping('comment_count'); if (isset($variables['node']->comment_count) && !empty($comment_count_mapping['properties'])) { // Annotates the 'x comments' link in teaser view. if (isset($variables['content']['links']['comment']['#links']['comment-comments'])) { @@ -378,7 +378,7 @@ function rdf_preprocess_field(&$variables) { $bundle = $element['#bundle']; $field_name = $element['#field_name']; $field_mapping = rdf_get_mapping($entity_type, $bundle) - ->getFieldMapping($field_name); + ->getPreparedFieldMapping($field_name); if (!empty($field_mapping)) { foreach ($element['#items'] as $delta => $item) { @@ -407,7 +407,7 @@ function rdf_preprocess_user(&$variables) { $account = $variables['elements']['#user']; $uri = $account->uri(); $mapping = rdf_get_mapping('user', 'user'); - $bundle_mapping = $mapping->getBundleMapping(); + $bundle_mapping = $mapping->getPreparedBundleMapping(); // Adds RDFa markup to the user profile page. Fields displayed in this page // will automatically describe the user. @@ -429,7 +429,7 @@ function rdf_preprocess_user(&$variables) { ); // Adds the markup for username as language neutral literal, see // rdf_preprocess_username(). - $name_mapping = $mapping->getFieldMapping('name'); + $name_mapping = $mapping->getPreparedFieldMapping('name'); if (!empty($name_mapping['properties'])) { $username_meta = array( '#tag' => 'meta', @@ -473,20 +473,20 @@ function rdf_preprocess_username(&$variables) { // Add RDF type of user. $mapping = rdf_get_mapping('user', 'user'); - $bundle_mapping = $mapping->getBundleMapping(); + $bundle_mapping = $mapping->getPreparedBundleMapping(); if (!empty($bundle_mapping['types'])) { $attributes['typeof'] = $bundle_mapping['types']; } // Annotate the username in RDFa. A property attribute is used with an empty // datatype attribute to ensure the username is parsed as a plain literal // in RDFa 1.0 and 1.1. - $name_mapping = $mapping->getFieldMapping('name'); + $name_mapping = $mapping->getPreparedFieldMapping('name'); if (!empty($name_mapping)) { $attributes['property'] = $name_mapping['properties']; $attributes['datatype'] = ''; } // Add the homepage RDFa markup if present. - $homepage_mapping = $mapping->getFieldMapping('homepage'); + $homepage_mapping = $mapping->getPreparedFieldMapping('homepage'); if (!empty($variables['homepage']) && !empty($homepage_mapping)) { $attributes['rel'] = $homepage_mapping['properties']; } @@ -510,7 +510,7 @@ function rdf_preprocess_username(&$variables) { function rdf_preprocess_comment(&$variables) { $comment = $variables['comment']; $mapping = rdf_get_mapping('comment', $comment->bundle()); - $bundle_mapping = $mapping->getBundleMapping(); + $bundle_mapping = $mapping->getPreparedBundleMapping(); if (!empty($bundle_mapping['types'])) { // Adds RDFa markup to the comment container. The about attribute specifies @@ -523,7 +523,7 @@ function rdf_preprocess_comment(&$variables) { } // Adds RDFa markup for the date of the comment. - $created_mapping = $mapping->getFieldMapping('created'); + $created_mapping = $mapping->getPreparedFieldMapping('created'); if (!empty($created_mapping)) { // The comment date is precomputed as part of the rdf_data so that it can be // cached as part of the entity. @@ -532,12 +532,12 @@ function rdf_preprocess_comment(&$variables) { $variables['rdf_template_variable_attributes']['submitted'] = $date_attributes; } // Adds RDFa markup for the relation between the comment and its author. - $uid_mapping = $mapping->getFieldMapping('uid'); + $uid_mapping = $mapping->getPreparedFieldMapping('uid'); if (!empty($uid_mapping)) { $variables['rdf_template_variable_attributes']['author']['rel'] = $uid_mapping['properties']; $variables['rdf_template_variable_attributes']['submitted']['rel'] = $uid_mapping['properties']; } - $title_mapping = $mapping->getFieldMapping('title'); + $title_mapping = $mapping->getPreparedFieldMapping('title'); if (!empty($title_mapping)) { // Adds RDFa markup to the subject of the comment. Because the RDFa markup // is added to an

tag which might contain HTML code, we specify an @@ -549,7 +549,7 @@ function rdf_preprocess_comment(&$variables) { // Annotates the parent relationship between the current comment and the node // it belongs to. If available, the parent comment is also annotated. - $pid_mapping = $mapping->getFieldMapping('pid'); + $pid_mapping = $mapping->getPreparedFieldMapping('pid'); if (!empty($pid_mapping)) { // Adds the relation to the parent node. $parent_node_attributes['rel'] = $pid_mapping['properties']; @@ -575,8 +575,8 @@ function rdf_preprocess_comment(&$variables) { function rdf_preprocess_taxonomy_term(&$variables) { $term = $variables['term']; $mapping = rdf_get_mapping('taxonomy_term', $term->bundle()); - $bundle_mapping = $mapping->getBundleMapping(); - $name_field_mapping = $mapping->getFieldMapping('name'); + $bundle_mapping = $mapping->getPreparedBundleMapping(); + $name_field_mapping = $mapping->getPreparedFieldMapping('name'); // Adds the RDF type of the term and the term name in a tag. $term_label_meta = array( '#tag' => 'meta', @@ -605,11 +605,11 @@ function rdf_field_attach_view_alter(&$output, $context) { if (isset($item['entity'])) { $term = $item['entity']; $mapping = rdf_get_mapping('taxonomy_term', $term->bundle()); - $bundle_mapping = $mapping->getBundleMapping(); + $bundle_mapping = $mapping->getPreparedBundleMapping(); if (!empty($bundle_mapping['types'])) { $element[$delta]['#options']['attributes']['typeof'] = $bundle_mapping['types']; } - $name_field_mapping = $mapping->getFieldMapping('name'); + $name_field_mapping = $mapping->getPreparedFieldMapping('name'); if (!empty($name_field_mapping['properties'])) { // A property attribute is used with an empty datatype attribute so // the term name is parsed as a plain literal in RDFa 1.0 and 1.1. diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index f20598e..265031f 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -95,27 +95,27 @@ function tracker_page($account = NULL, $set_title = FALSE) { // added to the td tag which might contain HTML code, we specify an // empty datatype to ensure the value of the title read by the RDFa // parsers is a plain literal. - $title_mapping = $mapping->getFieldMapping('title'); + $title_mapping = $mapping->getPreparedFieldMapping('title'); $row['title'] += rdf_rdfa_attributes($title_mapping) + array('datatype' => ''); // Annotates the td tag containing the author of the node. - $uid_mapping = $mapping->getFieldMapping('uid'); + $uid_mapping = $mapping->getPreparedFieldMapping('uid'); $row['author'] += rdf_rdfa_attributes($uid_mapping); // Annotates the td tag containing the number of replies. We add the // content attribute to ensure that only the comment count is used as // the value for 'num_replies'. Otherwise, other text such as a link // to the number of new comments could be included in the 'num_replies' // value. - $comment_count_mapping = $mapping->getFieldMapping('comment_count'); + $comment_count_mapping = $mapping->getPreparedFieldMapping('comment_count'); $row['replies'] += rdf_rdfa_attributes($comment_count_mapping); $row['replies'] += array('content' => $node->comment_count); // If the node has no comments, we assume the node itself was modified // and apply 'changed' in addition to 'last_activity'. If there are // comments present, we cannot infer whether the node itself was // modified or a comment was posted, so we use only 'last_activity'. - $last_activity_mapping = $mapping->getFieldMapping('last_activity'); + $last_activity_mapping = $mapping->getPreparedFieldMapping('last_activity'); $last_activity_attributes = rdf_rdfa_attributes($last_activity_mapping, $node->last_activity); if ($node->comment_count == 0) { - $changed_mapping = $mapping->getFieldMapping('changed'); + $changed_mapping = $mapping->getPreparedFieldMapping('changed'); $changed_attributes = rdf_rdfa_attributes($changed_mapping, $node->last_activity); $last_activity_attributes['property'] = array_merge($last_activity_attributes['property'], $changed_attributes['property']); }