diff --git a/variable.form.inc b/variable.form.inc
index 1557bc1..4af480f 100644
--- a/variable.form.inc
+++ b/variable.form.inc
@@ -17,7 +17,7 @@ function variable_form_element($variable, $options = array()) {
     $element = variable_form_element_options($variable, $options);
   }
   else {
-    $element = variable_form_element_default($variable, $options); 
+    $element = variable_form_element_default($variable, $options);
   }
   if (!empty($variable['validate callback'])) {
     $element['#validate'][] = $variable['validate callback'];
@@ -57,7 +57,7 @@ function variable_form_element_array($variable, $options = array()) {
     }
     else {
       $element[$key] = $item['element'] + array('#title' => $title, '#default_value' => isset($value[$key]) ? $value[$key] : '');
-    }  
+    }
   }
   return $element;
 }
@@ -97,7 +97,7 @@ function variable_form_element_default($variable, $options = array()) {
 
 /**
  * Build form element for unknown variable.
- * 
+ *
  * This is not an editable form element but a form item.
  */
 function variable_form_element_unknown($variable, $options = array()) {
@@ -112,6 +112,28 @@ function variable_form_element_unknown($variable, $options = array()) {
 }
 
 /**
+ * Build form element for text_format variable.
+ */
+function variable_form_element_text_format($variable, $options = array()) {
+  $variable += array('element' => array(), 'title' => '', 'description' => '');
+  $type = variable_get_type($variable['type']) + array('element' => array());
+  $element = $variable['element'] + array(
+    '#title' => $variable['title'],
+    '#description' => $variable['description'],
+  ) + $type['element'];
+  $value = variable_get_value($variable, $options);
+  if (isset($value) && is_array($value)) {
+    if (isset($value['value'])) {
+      $element['#default_value'] = $value['value'];
+    }
+    if (isset($value['format'])) {
+      $element['#format'] = $value['format'];
+    }
+  }
+  return $element;
+}
+
+/**
  * Build options variables
  */
 function variable_form_element_options($variable, $options = array()) {
@@ -150,6 +172,6 @@ function theme_variable_table_select($variables) {
   // Add a "Select all" checkbox.
   drupal_add_js('misc/tableselect.js');
   $header['element'] = array('class' => array('select-all'));
-  
+
   return theme('table', array('header' => array_values($header), 'rows' => $rows));
 }
\ No newline at end of file
diff --git a/variable.variable.inc b/variable.variable.inc
index 34d8d67..80ef5e1 100644
--- a/variable.variable.inc
+++ b/variable.variable.inc
@@ -1,4 +1,4 @@
-<?php 
+<?php
 /**
  * @file
  * Variable module hook implementations
@@ -48,7 +48,7 @@ function variable_variable_type_info() {
     'element' => array('#type' => 'textfield'),
     'access' => 'administer site configuration',
   );
-  // Enable/Disable 
+  // Enable/Disable
   $type['enable'] = array(
     'title' => t('Enable'),
     'options' => array(t('Disabled'), t('Enabled')),
@@ -134,6 +134,13 @@ function variable_variable_type_info() {
     'title' => t('Mail parts'),
     'options' => array('subject' => t('Subject'), 'body' => t('Body')),
   );
+  $type['text_format'] = array(
+    'title' => t('Formatted text'),
+    'element' => array('#type' => 'text_format'),
+    'element callback' => 'variable_form_element_text_format',
+    'format callback' => 'variable_format_text_format',
+    'default callback' => 'variable_text_format_default',
+  );
   return $type;
 }
 
@@ -244,4 +251,21 @@ function variable_format_unknown($variable, $options = array()) {
  */
 function variable_options_select_number($variable, $options = array()) {
   return drupal_map_assoc($variable['options']);
+}
+
+/**
+ * Default callback for text_format.
+ */
+function variable_text_format_default($variable, $options = array()) {
+  return array(
+    'value' => '',
+    'format' => filter_default_format(),
+  );
+}
+
+/**
+ * Format text_format.
+ */
+function variable_format_text_format($variable, $options = array()) {
+  return check_markup($variable['value']['value'], $variable['value']['format']);
 }
\ No newline at end of file
