Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
drupal
Commits
11ae7967
Commit
11ae7967
authored
15 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#687712
by scor: Optimize rdf.module for displaying multiple comments.
parent
8ba741dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/rdf/rdf.module
+16
-3
16 additions, 3 deletions
modules/rdf/rdf.module
with
16 additions
and
3 deletions
modules/rdf/rdf.module
+
16
−
3
View file @
11ae7967
...
...
@@ -370,6 +370,19 @@ function rdf_entity_load($entities, $type) {
}
}
/**
* Implements hook_comment_load().
*/
function
rdf_comment_load
(
$comments
)
{
foreach
(
$comments
as
$comment
)
{
$comment
->
rdf_data
[
'date'
]
=
rdf_rdfa_attributes
(
$comment
->
rdf_mapping
[
'created'
],
$comment
->
created
);
$comment
->
rdf_data
[
'nid_uri'
]
=
url
(
'node/'
.
$comment
->
nid
);
if
(
$comment
->
pid
)
{
$comment
->
rdf_data
[
'pid_uri'
]
=
url
(
'comment/'
.
$comment
->
pid
,
array
(
'fragment'
=>
'comment-'
.
$comment
->
pid
));
}
}
}
/**
* Implements hook_theme().
*/
...
...
@@ -622,7 +635,7 @@ function rdf_preprocess_comment(&$variables) {
// Adds RDFa markup for the date of the comment.
if
(
!
empty
(
$comment
->
rdf_mapping
[
'created'
]))
{
$date_attributes_array
=
rdf_rdfa_attributes
(
$comment
->
rdf_
mapping
[
'cre
ate
d
'
]
,
$comment
->
created
)
;
$date_attributes_array
=
$comment
->
rdf_
data
[
'd
ate'
];
$variables
[
'rdf_template_variable_attributes_array'
][
'created'
]
=
$date_attributes_array
;
}
// Adds RDFa markup for the relation between the comment and its author.
...
...
@@ -643,13 +656,13 @@ function rdf_preprocess_comment(&$variables) {
if
(
!
empty
(
$comment
->
rdf_mapping
[
'pid'
]))
{
// Relation to parent node.
$parent_node_attributes
[
'rel'
]
=
$comment
->
rdf_mapping
[
'pid'
][
'predicates'
];
$parent_node_attributes
[
'resource'
]
=
url
(
'node/'
.
$comment
->
nid
)
;
$parent_node_attributes
[
'resource'
]
=
$comment
->
rdf_data
[
'nid_uri'
]
;
$variables
[
'rdf_metadata_attributes_array'
][]
=
$parent_node_attributes
;
// Relation to parent comment if it exists.
if
(
$comment
->
pid
!=
0
)
{
$parent_comment_attributes
[
'rel'
]
=
$comment
->
rdf_mapping
[
'pid'
][
'predicates'
];
$parent_comment_attributes
[
'resource'
]
=
url
(
'comment/'
.
$comment
->
pid
,
array
(
'fragment'
=>
'comment-'
.
$comment
->
pid
))
;
$parent_comment_attributes
[
'resource'
]
=
$comment
->
rdf_data
[
'pid_uri'
]
;
$variables
[
'rdf_metadata_attributes_array'
][]
=
$parent_comment_attributes
;
}
}
...
...
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