Output RDFa markup for type + title in taxonomy term reference and entity reference formatters

Created on 23 August 2013, over 11 years ago
Updated 5 June 2024, 7 months ago

Problem/Motivation

#1778122: Enable modules to inject attributes into field formatters, so that RDF attributes get output β†’ is switching all field formatters to use the new RDFa syntax where the mappings for each field are defined in the main entity (e.g. the mapping for a text field is defined in the mappings of the node). In the case of a taxonomy term for example, the mapping of the term (e.g. schema:about) is defined in the node, but the mappings for the term type and the term title are defined in the term mappings, not in the original node mappings. Drupal 7 currently supports type + title for taxonomy terms.

Proposed resolution

Extend rdf_entity_prepare_view() to add the additional mappings for type and title in $property->html_data_attributes for the appropriate fields (taxonomy term and entity reference), and add these attributes in the relevant formatters.

Remaining tasks

patch

User interface changes

none

API changes

none other than the markup change

πŸ“Œ Task
Status

Needs work

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada scor Toronto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Removed

        // Taxonomy terms triples.
        // Term 1.
        $expected_value = [
          'type' => 'uri',
          'value' => 'http://www.w3.org/2004/02/skos/core#Concept',
        ];
        // @todo Enable with https://www.drupal.org/node/2072791.
        // $this->assertTrue($graph->hasProperty($taxonomy_term_1_uri, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', $expected_value), 'Taxonomy term type found in RDF output (skos:Concept).');
        $expected_value = [
          'type' => 'literal',
          'value' => $term1->getName(),
        ];
        // $this->assertTrue($graph->hasProperty($taxonomy_term_1_uri, 'http://www.w3.org/2000/01/rdf-schema#label', $expected_value), 'Taxonomy term name found in RDF output (rdfs:label).');
        // Term 2.
        $expected_value = [
          'type' => 'uri',
          'value' => 'http://www.w3.org/2004/02/skos/core#Concept',
        ];
        // $this->assertTrue($graph->hasProperty($taxonomy_term_2_uri, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', $expected_value), 'Taxonomy term type found in RDF output (skos:Concept).');
        $expected_value = [
          'type' => 'literal',
          'value' => $term2->getName(),
        ];
        // $this->assertTrue($graph->hasProperty($taxonomy_term_2_uri, 'http://www.w3.org/2000/01/rdf-schema#label', $expected_value), 'Taxonomy term name found in RDF output (rdfs:label).');
    

    Which can be added back with this issue but not going to keep this in the main repo if I can help it.

Production build 0.71.5 2024