update core to 7.36
This commit is contained in:
@@ -993,12 +993,7 @@ function comment_build_content($comment, $node, $view_mode = 'full', $langcode =
|
||||
$comment->content = array();
|
||||
|
||||
// Allow modules to change the view mode.
|
||||
$context = array(
|
||||
'entity_type' => 'comment',
|
||||
'entity' => $comment,
|
||||
'langcode' => $langcode,
|
||||
);
|
||||
drupal_alter('entity_view_mode', $view_mode, $context);
|
||||
$view_mode = key(entity_view_mode_prepare('comment', array($comment->cid => $comment), $view_mode, $langcode));
|
||||
|
||||
// Build fields content.
|
||||
field_attach_prepare_view('comment', array($comment->cid => $comment), $view_mode, $langcode);
|
||||
@@ -1108,17 +1103,26 @@ function comment_links($comment, $node) {
|
||||
* An array in the format expected by drupal_render().
|
||||
*/
|
||||
function comment_view_multiple($comments, $node, $view_mode = 'full', $weight = 0, $langcode = NULL) {
|
||||
field_attach_prepare_view('comment', $comments, $view_mode, $langcode);
|
||||
entity_prepare_view('comment', $comments, $langcode);
|
||||
$build = array();
|
||||
$entities_by_view_mode = entity_view_mode_prepare('comment', $comments, $view_mode, $langcode);
|
||||
foreach ($entities_by_view_mode as $entity_view_mode => $entities) {
|
||||
field_attach_prepare_view('comment', $entities, $entity_view_mode, $langcode);
|
||||
entity_prepare_view('comment', $entities, $langcode);
|
||||
|
||||
foreach ($entities as $entity) {
|
||||
$build[$entity->cid] = comment_view($entity, $node, $entity_view_mode, $langcode);
|
||||
}
|
||||
}
|
||||
|
||||
$build = array(
|
||||
'#sorted' => TRUE,
|
||||
);
|
||||
foreach ($comments as $comment) {
|
||||
$build[$comment->cid] = comment_view($comment, $node, $view_mode, $langcode);
|
||||
$build[$comment->cid]['#weight'] = $weight;
|
||||
$weight++;
|
||||
}
|
||||
// Sort here, to preserve the input order of the entities that were passed to
|
||||
// this function.
|
||||
uasort($build, 'element_sort');
|
||||
$build['#sorted'] = TRUE;
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
@@ -2603,7 +2607,7 @@ function comment_unpublish_action($comment, $context = array()) {
|
||||
/**
|
||||
* Unpublishes a comment if it contains certain keywords.
|
||||
*
|
||||
* @param $comment
|
||||
* @param object $comment
|
||||
* Comment object to modify.
|
||||
* @param array $context
|
||||
* Array with components:
|
||||
@@ -2615,10 +2619,13 @@ function comment_unpublish_action($comment, $context = array()) {
|
||||
* @see comment_unpublish_by_keyword_action_submit()
|
||||
*/
|
||||
function comment_unpublish_by_keyword_action($comment, $context) {
|
||||
$node = node_load($comment->nid);
|
||||
$build = comment_view($comment, $node);
|
||||
$text = drupal_render($build);
|
||||
foreach ($context['keywords'] as $keyword) {
|
||||
$text = drupal_render($comment);
|
||||
if (strpos($text, $keyword) !== FALSE) {
|
||||
$comment->status = COMMENT_NOT_PUBLISHED;
|
||||
comment_save($comment);
|
||||
watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject));
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user