Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
fe423209
Commit
fe423209
authored
Jul 29, 2010
by
Dries Buytaert
Browse files
- Patch
#721164
by bleen18, ChrisRL, sun: comment previews #prefix problem.
parent
93cf8ab3
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/comment/comment.module
View file @
fe423209
...
...
@@ -913,26 +913,28 @@ function comment_view($comment, $node, $view_mode = 'full') {
'#view_mode'
=>
$view_mode
,
);
$prefix
=
''
;
$is_threaded
=
isset
(
$comment
->
divs
)
&&
variable_get
(
'comment_default_mode_'
.
$node
->
type
,
COMMENT_MODE_THREADED
)
==
COMMENT_MODE_THREADED
;
if
(
empty
(
$comment
->
in_preview
))
{
$prefix
=
''
;
$is_threaded
=
isset
(
$comment
->
divs
)
&&
variable_get
(
'comment_default_mode_'
.
$node
->
type
,
COMMENT_MODE_THREADED
)
==
COMMENT_MODE_THREADED
;
// Add 'new' anchor if needed.
if
(
!
empty
(
$comment
->
first_new
))
{
$prefix
.
=
"<a id=
\"
new
\"
></a>
\n
"
;
}
// Add 'new' anchor if needed.
if
(
!
empty
(
$comment
->
first_new
))
{
$prefix
.
=
"<a id=
\"
new
\"
></a>
\n
"
;
}
// Add indentation div or close open divs as needed.
if
(
$is_threaded
)
{
$prefix
.
=
$comment
->
divs
<=
0
?
str_repeat
(
'</div>'
,
abs
(
$comment
->
divs
))
:
"
\n
"
.
'<div class="indented">'
;
}
// Add indentation div or close open divs as needed.
if
(
$is_threaded
)
{
$prefix
.
=
$comment
->
divs
<=
0
?
str_repeat
(
'</div>'
,
abs
(
$comment
->
divs
))
:
"
\n
"
.
'<div class="indented">'
;
}
// Add anchor for each comment.
$prefix
.
=
"<a id=
\"
comment-
$comment->cid
\"
></a>
\n
"
;
$build
[
'#prefix'
]
=
$prefix
;
// Add anchor for each comment.
$prefix
.
=
"<a id=
\"
comment-
$comment->cid
\"
></a>
\n
"
;
$build
[
'#prefix'
]
=
$prefix
;
// Close all open divs.
if
(
$is_threaded
&&
!
empty
(
$comment
->
divs_final
))
{
$build
[
'#suffix'
]
=
str_repeat
(
'</div>'
,
$comment
->
divs_final
);
// Close all open divs.
if
(
$is_threaded
&&
!
empty
(
$comment
->
divs_final
))
{
$build
[
'#suffix'
]
=
str_repeat
(
'</div>'
,
$comment
->
divs_final
);
}
}
// Allow modules to modify the structured comment.
...
...
@@ -2009,11 +2011,7 @@ function comment_preview($comment) {
$comment
->
changed
=
REQUEST_TIME
;
$comment
->
in_preview
=
TRUE
;
$comment_build
=
comment_view
(
$comment
,
$node
);
$comment_build
+=
array
(
'#weight'
=>
-
100
,
'#prefix'
=>
'<div class="preview">'
,
'#suffix'
=>
'</div>'
,
);
$comment_build
[
'#weight'
]
=
-
100
;
$form
[
'comment_preview'
]
=
$comment_build
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment