From b61918f0ff581a7b7adf51d26dc2e4e17ab3ba32 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Mon, 17 Jun 2013 02:01:55 +0200
Subject: [PATCH] Issue #2009018 by InternetDevels: Replace theme() with
 drupal_render() in filter module.

---
 core/modules/filter/filter.module                  | 12 ++++++++++--
 .../lib/Drupal/filter/Plugin/Filter/FilterHtml.php | 14 ++++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index bb9b748d1dd..09497740a3d 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -1022,7 +1022,11 @@ function theme_filter_guidelines($variables) {
   $attributes['class'][] = 'filter-guidelines-' . $format->format;
   $output = '<div' . new Attribute($attributes) . '>';
   $output .= '<h4 class="label">' . check_plain($format->name) . '</h4>';
-  $output .= theme('filter_tips', array('tips' => _filter_tips($format->format, FALSE)));
+  $filter_tips = array(
+    '#theme' => 'filter_tips',
+    '#tips' => _filter_tips($format->format, FALSE),
+  );
+  $output .= drupal_render($filter_tips);
   $output .= '</div>';
   return $output;
 }
@@ -1404,7 +1408,11 @@ function _filter_html_image_secure_process($text) {
       }
     }
     // Replace an invalid image with an error indicator.
-    theme('filter_html_image_secure_image', array('image' => $image));
+    $filter_html_image_secure_image = array(
+      '#theme' => 'filter_html_image_secure_image',
+      '#image' => $image,
+    );
+    drupal_render($filter_html_image_secure_image);
   }
   $text = filter_dom_serialize($html_dom);
   return $text;
diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php
index c939c2720ba..fe6237903bf 100644
--- a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php
+++ b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php
@@ -134,7 +134,12 @@ class FilterHtml extends FilterBase {
         );
       }
     }
-    $output .= theme('table', array('header' => $header, 'rows' => $rows));
+    $table = array(
+      '#theme' => 'table',
+      '#header' => $header,
+      '#rows' => $rows,
+    );
+    $output .= drupal_render($table);
 
     $output .= '<p>' . t('Most unusual characters can be directly entered without any problems.') . '</p>';
     $output .= '<p>' . t('If you do encounter problems, try using HTML character entities. A common example looks like &amp;amp; for an ampersand &amp; character. For a full list of entities see HTML\'s <a href="@html-entities">entities</a> page. Some of the available characters include:', array('@html-entities' => 'http://www.w3.org/TR/html4/sgml/entities.html')) . '</p>';
@@ -154,7 +159,12 @@ class FilterHtml extends FilterBase {
         array('data' => $entity[1], 'class' => array('get'))
       );
     }
-    $output .= theme('table', array('header' => $header, 'rows' => $rows));
+    $table = array(
+      '#theme' => 'table',
+      '#header' => $header,
+      '#rows' => $rows,
+    );
+    $output .= drupal_render($table);
     return $output;
   }