Commit fa6444e0 authored by alexpott's avatar alexpott

Issue #2008974 by K15.Multik, drupee: Replace theme() with drupal_render() in book module.

parent f6f04788
...@@ -219,8 +219,9 @@ function theme_book_admin_table($variables) { ...@@ -219,8 +219,9 @@ function theme_book_admin_table($variables) {
$form[$key]['mlid']['#attributes']['class'] = array('book-mlid'); $form[$key]['mlid']['#attributes']['class'] = array('book-mlid');
$form[$key]['weight']['#attributes']['class'] = array('book-weight'); $form[$key]['weight']['#attributes']['class'] = array('book-weight');
$indentation = array('#theme' => 'indentation', '#size' => $form[$key]['depth']['#value'] - 2);
$data = array( $data = array(
theme('indentation', array('size' => $form[$key]['depth']['#value'] - 2)) . drupal_render($form[$key]['title']), drupal_render($indentation) . drupal_render($form[$key]['title']),
drupal_render($form[$key]['weight']), drupal_render($form[$key]['weight']),
drupal_render($form[$key]['plid']) . drupal_render($form[$key]['mlid']), drupal_render($form[$key]['plid']) . drupal_render($form[$key]['mlid']),
); );
...@@ -254,6 +255,6 @@ function theme_book_admin_table($variables) { ...@@ -254,6 +255,6 @@ function theme_book_admin_table($variables) {
$row['class'][] = 'draggable'; $row['class'][] = 'draggable';
$rows[] = $row; $rows[] = $row;
} }
$table = array('#theme' => 'table', '#header' => $header, '#rows' => $rows, '#attributes' => array('id' => 'book-outline'), '#empty' => t('No book content available.'));
return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'book-outline'), 'empty' => t('No book content available.'))); return drupal_render($table);
} }
...@@ -773,8 +773,9 @@ function book_node_load($nodes, $types) { ...@@ -773,8 +773,9 @@ function book_node_load($nodes, $types) {
function book_node_view(EntityInterface $node, EntityDisplay $display, $view_mode) { function book_node_view(EntityInterface $node, EntityDisplay $display, $view_mode) {
if ($view_mode == 'full') { if ($view_mode == 'full') {
if (!empty($node->book['bid']) && empty($node->in_preview)) { if (!empty($node->book['bid']) && empty($node->in_preview)) {
$book_navigation = array( '#theme' => 'book_navigation', '#book_link' => $node->book);
$node->content['book_navigation'] = array( $node->content['book_navigation'] = array(
'#markup' => theme('book_navigation', array('book_link' => $node->book)), '#markup' => drupal_render($book_navigation),
'#weight' => 100, '#weight' => 100,
'#attached' => array( '#attached' => array(
'css' => array( 'css' => array(
...@@ -1189,8 +1190,8 @@ function book_node_export(EntityInterface $node, $children = '') { ...@@ -1189,8 +1190,8 @@ function book_node_export(EntityInterface $node, $children = '') {
unset($build['#theme']); unset($build['#theme']);
// @todo Rendering should happen in the template using render(). // @todo Rendering should happen in the template using render().
$node->rendered = drupal_render($build); $node->rendered = drupal_render($build);
$book_node_export_html = array('#theme' => 'book_node_export_html', '#node' => $node, '#children' => $children );
return theme('book_node_export_html', array('node' => $node, 'children' => $children)); return drupal_render($book_node_export_html);
} }
/** /**
......
...@@ -72,7 +72,8 @@ function book_export_html(EntityInterface $node) { ...@@ -72,7 +72,8 @@ function book_export_html(EntityInterface $node) {
if (isset($node->book)) { if (isset($node->book)) {
$tree = book_menu_subtree_data($node->book); $tree = book_menu_subtree_data($node->book);
$contents = book_export_traverse($tree, 'book_node_export'); $contents = book_export_traverse($tree, 'book_node_export');
return theme('book_export_html', array('title' => $node->label(), 'contents' => $contents, 'depth' => $node->book['depth'])); $book_exported_html = array('#theme' => 'book_export_html', '#title' => $node->label(), '#contents' => $contents, '#depth' => $node->book['depth']);
return drupal_render($book_exported_html);
} }
else { else {
throw new NotFoundHttpException(); throw new NotFoundHttpException();
......
...@@ -67,8 +67,8 @@ public function adminOverview() { ...@@ -67,8 +67,8 @@ public function adminOverview() {
); );
$rows[] = $row; $rows[] = $row;
} }
$table = array('#theme' => 'table', '#header' => $headers, '#rows' => $rows, '#empty' => t('No books available.'));
return theme('table', array('header' => $headers, 'rows' => $rows, 'empty' => t('No books available.'))); return drupal_render($table);
} }
/** /**
...@@ -82,8 +82,8 @@ public function bookRender() { ...@@ -82,8 +82,8 @@ public function bookRender() {
foreach ($this->bookManager->getAllBooks() as $book) { foreach ($this->bookManager->getAllBooks() as $book) {
$book_list[] = l($book['title'], $book['href'], $book['options']); $book_list[] = l($book['title'], $book['href'], $book['options']);
} }
$item_list = array('#theme' => 'item_list' , '#items' => $book_list);
return theme('item_list', array('items' => $book_list)); return drupal_render($item_list);
} }
} }
...@@ -107,8 +107,9 @@ public function build() { ...@@ -107,8 +107,9 @@ public function build() {
$data = array_shift($tree); $data = array_shift($tree);
$below = menu_tree_output($data['below']); $below = menu_tree_output($data['below']);
if (!empty($below)) { if (!empty($below)) {
$book_title_link = array('#theme' => 'book_title_link', '#link' => $data['link']);
return array( return array(
'#title' => theme('book_title_link', array('link' => $data['link'])), '#title' => drupal_render($book_title_link),
$below, $below,
); );
} }
......
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