Commit 39cc830a authored by alexpott's avatar alexpott

Issue #2008980 by jeroen12345, hussainweb: Replace theme() with drupal_render() in comment module.

parent 0453593c
......@@ -114,6 +114,10 @@ function comment_admin_overview($form, &$form_state, $arg) {
// Remove the first node title from the node_titles array and attach to
// the comment.
$node_title = $comment->nid->entity->label();
$username = array(
'#theme' => 'username',
'#account' => comment_prepare_author($comment),
);
$options[$comment->id()] = array(
'subject' => array(
'data' => array(
......@@ -123,7 +127,7 @@ function comment_admin_overview($form, &$form_state, $arg) {
'#options' => array('attributes' => array('title' => truncate_utf8($comment->comment_body->value, 128)), 'fragment' => 'comment-' . $comment->id()),
),
),
'author' => theme('username', array('account' => comment_prepare_author($comment))),
'author' => drupal_render($username),
'posted_in' => array(
'data' => array(
'#type' => 'link',
......
......@@ -535,7 +535,11 @@ function theme_comment_block($variables) {
}
if ($items) {
return theme('item_list', array('items' => $items));
$item_list = array(
'#theme' => 'item_list',
'#items' => $items,
);
return drupal_render($item_list);
}
else {
return t('No comments available.');
......@@ -596,8 +600,12 @@ function comment_node_view(EntityInterface $node, EntityDisplay $display, $view_
}
}
else {
$comment_post_forbidden = array(
'#theme' => 'comment_post_forbidden',
'#node' => $node,
);
$links['comment-forbidden'] = array(
'title' => theme('comment_post_forbidden', array('node' => $node)),
'title' => drupal_render($comment_post_forbidden),
'html' => TRUE,
);
}
......@@ -626,8 +634,12 @@ function comment_node_view(EntityInterface $node, EntityDisplay $display, $view_
}
}
else {
$comment_post_forbidden = array(
'#theme' => 'comment_post_forbidden',
'#node' => $node,
);
$links['comment-forbidden'] = array(
'title' => theme('comment_post_forbidden', array('node' => $node)),
'title' => drupal_render($comment_post_forbidden),
'html' => TRUE,
);
}
......@@ -929,7 +941,11 @@ function comment_links(Comment $comment, EntityInterface $node) {
);
}
if (empty($links)) {
$links['comment-forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
$comment_post_forbidden = array(
'#theme' => 'comment_post_forbidden',
'#node' => $node,
);
$links['comment-forbidden']['title'] = drupal_render($comment_post_forbidden);
$links['comment-forbidden']['html'] = TRUE;
}
}
......@@ -1526,7 +1542,11 @@ function template_preprocess_comment(&$variables) {
$account = comment_prepare_author($comment);
// @todo Do not call theme() here. We do this for purposes of t().
$variables['author'] = theme('username', array('account' => $account));
$username = array(
'#theme' => 'username',
'#account' => $account,
);
$variables['author'] = drupal_render($username);
$variables['new'] = $comment->new->value ? t('new') : '';
$variables['created'] = format_date($comment->created->value);
// Avoid calling format_date() twice on the same timestamp.
......@@ -1567,7 +1587,11 @@ function template_preprocess_comment(&$variables) {
$account_parent = comment_prepare_author($comment_parent);
$variables['parent_comment'] = $comment_parent;
// @todo Do not call theme() here. We do this for purposes of t().
$variables['parent_author'] = theme('username', array('account' => $account_parent));
$username = array(
'#theme' => 'username',
'#account' => $account_parent,
);
$variables['parent_author'] = drupal_render($username);
$variables['parent_created'] = format_date($comment_parent->created->value);
// Avoid calling format_date() twice on the same timestamp.
if ($comment_parent->changed->value == $comment_parent->created->value) {
......
......@@ -92,7 +92,11 @@ public function form(array $form, array &$form_state) {
elseif ($user->uid) {
$form['author']['name']['#type'] = 'item';
$form['author']['name']['#value'] = $form['author']['name']['#default_value'];
$form['author']['name']['#markup'] = theme('username', array('account' => $user));
$username = array(
'#theme' => 'username',
'#account' => $user,
);
$form['author']['name']['#markup'] = drupal_render($username);
}
// Add author e-mail and homepage fields depending on the current user.
......
......@@ -61,9 +61,11 @@ function render($values) {
$account = entity_create('user', array());
$account->name = $this->getValue($values);
$account->uid = $values->{$this->uid};
return theme('username', array(
'account' => $account
));
$username = array(
'#theme' => 'username',
'#account' => $account,
);
return drupal_render($username);
}
else {
return $this->sanitizeValue($this->getValue($values));
......
......@@ -54,10 +54,11 @@ function render_link($data, $values) {
$account->uid = $this->getValue($values, 'uid');
$account->name = $this->getValue($values);
$account->homepage = $this->getValue($values, 'homepage');
return theme('username', array(
'account' => $account
));
$username = array(
'#theme' => 'username',
'#account' => $account,
);
return drupal_render($username);
}
else {
return $data;
......
......@@ -154,11 +154,13 @@ function render($row) {
$item->elements = $comment->rss_elements;
$item->cid = $comment->id();
return theme($this->themeFunctions(), array(
'view' => $this->view,
'options' => $this->options,
'row' => $item
));
$build = array(
'#theme' => $this->themeFunctions(),
'#view' => $this->view,
'#options' => $this->options,
'#row' => $item,
);
return drupal_render($build);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment