Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443488
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443488
Commits
e8cfe921
Commit
e8cfe921
authored
14 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#694994
by Stefan Freudenberg: fixed the RDFa markup for number of comments on teasers.
parent
d5ce7f52
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/rdf/rdf.module
+6
-0
6 additions, 0 deletions
modules/rdf/rdf.module
modules/rdf/rdf.test
+30
-0
30 additions, 0 deletions
modules/rdf/rdf.test
with
36 additions
and
0 deletions
modules/rdf/rdf.module
+
6
−
0
View file @
e8cfe921
...
...
@@ -483,6 +483,12 @@ function rdf_preprocess_node(&$variables) {
$comment_count_attributes
[
'property'
]
=
$variables
[
'node'
]
->
rdf_mapping
[
'comment_count'
][
'predicates'
];
$comment_count_attributes
[
'content'
]
=
$variables
[
'node'
]
->
comment_count
;
$comment_count_attributes
[
'datatype'
]
=
$variables
[
'node'
]
->
rdf_mapping
[
'comment_count'
][
'datatype'
];
// According to RDFa parsing rule number 4, a new subject URI is created
// from the href attribute if no rel/rev attribute is present. To get
// the original node URL from the about attribute of the parent container
// we set an empty rel attribute which triggers rule number 5. See
// http://www.w3.org/TR/rdfa-syntax/#sec_5.5.
$comment_count_attributes
[
'rel'
]
=
''
;
$variables
[
'content'
][
'links'
][
'comment'
][
'#links'
][
'comment_comments'
][
'attributes'
]
+=
$comment_count_attributes
;
}
// In full node view, the number of comments is not displayed by
...
...
This diff is collapsed.
Click to expand it.
modules/rdf/rdf.test
+
30
−
0
View file @
e8cfe921
...
...
@@ -371,6 +371,36 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase {
}
}
class
RdfCommentAttributesTestCase
extends
DrupalWebTestCase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'RDF comment mapping'
,
'description'
=>
'Tests the RDFa markup of comments.'
,
'group'
=>
'RDF'
,
);
}
public
function
setUp
()
{
parent
::
setUp
(
'rdf'
,
'rdf_test'
,
'comment'
);
// Enable anonymous posting of content.
user_role_change_permissions
(
DRUPAL_ANONYMOUS_RID
,
array
(
'create article content'
=>
TRUE
,
'access comments'
=>
TRUE
,
'post comments'
=>
TRUE
,
'post comments without approval'
=>
TRUE
,
));
}
public
function
testAttributesInTeaser
()
{
$node
=
$this
->
drupalCreateNode
(
array
(
'type'
=>
'article'
,
'uid'
=>
1
,
'promote'
=>
1
));
CommentHelperCase
::
postComment
(
$node
,
$this
->
randomName
(),
$this
->
randomName
());
$this
->
drupalGet
(
''
);
$comment_count_link
=
$this
->
xpath
(
'//div[@about=:url]//a[contains(@property, "sioc:num_replies") and @rel=""]'
,
array
(
':url'
=>
url
(
"node/
$node->nid
"
)));
$this
->
assertTrue
(
!
empty
(
$comment_count_link
),
t
(
'Empty rel attribute found in comment count link.'
));
}
}
class
RdfTrackerAttributesTestCase
extends
DrupalWebTestCase
{
public
static
function
getInfo
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment