Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / src / Drupal / DrupalUtil.php
diff --git a/vendor/drush/drush/src/Drupal/DrupalUtil.php b/vendor/drush/drush/src/Drupal/DrupalUtil.php
new file mode 100644 (file)
index 0000000..c44884c
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+namespace Drush\Drupal;
+
+class DrupalUtil
+{
+
+    /**
+     * Output a Drupal render array, object or string as plain text.
+     *
+     * @param string $data
+     *   Data to render.
+     *
+     * @return string
+     *   The plain-text representation of the input.
+     */
+    public static function drushRender($data)
+    {
+        if (is_array($data)) {
+            $data = \Drupal::service('renderer')->renderRoot($data);
+        }
+
+        $data = \Drupal\Core\Mail\MailFormatHelper::htmlToText($data);
+        return $data;
+    }
+}