As done for other modules we need to add RDF to comment module.

There are three steps to this:

1. Add comment_rdf_mapping to the comment module with something like this

 return array(
    'comment' => array(
      'rdftype' => array('sioct:Post'),
      'title'   => array('dc:title'),
      'created' => array(
        'properties' => array('dc:date', 'dc:created'),
        'datatype' => 'xsd:dateTime',
        'callback' => 'date_iso8601',
      ),
      'replyof'    => 'sioct:reply_of',
    )
  );

2. Use rdf_comment_view to add the RDF mapping to the comment object

function rdf_comment_view($comment){
  $comment->rdf_mapping = rdf_get_mapping('comment');
}

NB: We can't use rdf_comment_load which would be cleaner because there is currently a bug (will create issue and update this with that)

3. Use rdf_comment_preprocess to actually add the RDF in the template.

This process is also the general model for adding RDF to other entities.

CommentFileSizeAuthor
#2 comment.module23.patch9.94 KBstefan freudenberg

Comments

stefan freudenberg’s picture

To add markup to the date a comment has been posted I would need to disable escaping. Instead of

      print t('Submitted by !username on @datetime.',

I'd like to have

      print t('Submitted by !username on !datetime.',

in comment.tpl. Is it ok to change it?

stefan freudenberg’s picture

StatusFileSize
new9.94 KB

Implemented comment_rdf_mapping.

scor’s picture

Status: Active » Closed (fixed)

this was integrated in the main RDF patch #493030: RDF #1: core RDF module.