diff --git a/ds.field_ui.inc b/ds.field_ui.inc
index a32f578..0307d94 100644
--- a/ds.field_ui.inc
+++ b/ds.field_ui.inc
@@ -27,6 +27,9 @@ function ds_field_ui_fields_layouts(&$form, &$form_state) {
   // Add the fields.
   _ds_field_ui_fields($entity_type, $bundle, $view_mode, $form, $form_state);
 
+  // Add extra fields.
+  _ds_field_ui_custom_fields($entity_type, $bundle, $view_mode, $form, $form_state);
+
   // Attach js.
   $form['#attached']['js'][] = drupal_get_path('module', 'ds') . '/js/ds.js';
 
@@ -593,6 +596,22 @@ function ds_field_ui_fields_save($form, &$form_state) {
 }
 
 /**
+ * Save a new field directly from Field UI.
+ */
+function ds_field_ui_add_field_save($form, $form_state) {
+//   $commands = array();
+//   $commands[] = ajax_command_replace(NULL, "");
+//   $commands[] = ajax_command_prepend(NULL, theme('status_messages'));
+//   return array('#type' => 'ajax', '#commands' => $commands);
+
+  $form_state['redirect'] = $form_state['storage']['ref'];
+  dsm($form);
+  dsm($form_state);
+  //     die("OK ".$form_state['storage']['ref']);
+//     drupal_goto($form_state['storage']['ref']);
+}
+
+/**
  * Clone a fields layout.
  */
 function ds_field_ui_layout_clone($form, &$form_state) {
@@ -1360,6 +1379,124 @@ function _ds_field_ui_fields($entity_type, $bundle, $view_mode, &$form, &$form_s
 }
 
 /**
+ * Add tab for adding new fields on the fly.
+ *
+ * @param $entity_type
+ *   The name of the entity type.
+ * @param $bundle
+ *   The name of the bundle
+ * @param $view_mode
+ *   The name of the view_mode
+ * @param $form
+ *   A collection of form properties.
+ * @param $form_state
+ *   A collection of form_state properties.
+ */
+function _ds_field_ui_custom_fields($entity_type, $bundle, $view_mode, &$form, $form_state) {
+
+  $form['additional_settings']['add_custom_fields'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Add custom fields'),
+  );
+
+  $cfields = array();
+  $ajaxconf = array(
+    'callback' => '_ds_add_field_loadform',
+    'wrapper' => 'ds-add-field-target',
+    'method' => 'html',
+    'effect' => 'fade',
+  );
+
+  $cfields['custom_field'] = array(
+    '#type' => 'button',
+    '#value' => t('Add a field'),
+    '#name' => 'custom_field',
+    '#weight' => 10,
+    '#ajax' => $ajaxconf,
+  );
+
+  // Dynamic field.
+  $cfields['manage_ctools'] = array(
+    '#type' => 'button',
+    '#name' => 'manage_ctools',
+    '#value' => t('Add a dynamic field'),
+    '#weight' => 20,
+    '#ajax' => $ajaxconf,
+  );
+
+  // Preprocess field.
+  $cfields['manage_preprocess'] = array(
+    '#type' => 'button',
+    '#name' => 'manage_preprocess',
+    '#value' => t('Add a preprocess field'),
+    '#weight' => 25,
+    '#ajax' => $ajaxconf,
+  );
+
+  if (module_exists('block')) {
+    $cfields['manage_block'] = array(
+      '#type' => 'button',
+      '#name' => 'manage_block',
+      '#value' => t('Add a block field'),
+      '#weight' => 30,
+      '#ajax' => $ajaxconf,
+    );
+  }
+
+  $form['additional_settings']['add_custom_fields'] += $cfields;
+
+  $form['additional_settings']['add_custom_fields']['content'] = array(
+    '#markup' => "<div class='clear' id='ds-add-field-target'></div>",
+    '#weight' => 50,
+  );
+}
+
+/**
+ * Load the custom field form.
+ */
+function _ds_add_field_loadform($form, $form_state) {
+
+  switch($_POST['_triggering_element_name']) {
+
+    case "manage_ctools":
+      $form_name = "ds_edit_ctools_field_form";
+      break;
+
+    case "manage_preprocess":
+      $form_name = "ds_edit_preprocess_field_form";
+      break;
+
+    case "manage_block":
+      $form_name = "ds_edit_block_field_form";
+      break;
+
+    default:
+      $form_name = "ds_edit_custom_field_form";
+      break;
+  }
+
+  module_load_include('inc','ds','ds.fields');
+  module_load_include('inc','ds','ds.registry');
+
+  $form = drupal_get_form($form_name);
+
+  $menu_cb = _ds_menu();
+  foreach($menu_cb as $path => $mitem) {
+    if (is_array($mitem['page arguments']) && $form_name == $mitem['page arguments'][0]) {
+      break;
+    }
+  }
+
+  $form['#action'] = url($path);
+  $form['#submit'][] = 'ds_field_ui_add_field_save';
+
+  $url = parse_url($_SERVER['HTTP_REFERER']);
+  $form_state['storage']['ref'] = url(substr($url['path'],1));
+
+  return drupal_render($form);
+}
+
+/**
  * Utility function to check if we need to save anything for this field.
  */
 function _ds_field_valid($key, $field, &$form_state) {
