Index: views_attach.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_attach/views_attach.module,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 views_attach.module
--- views_attach.module	20 Jan 2009 21:19:48 -0000	1.1.2.3
+++ views_attach.module	27 Jan 2009 21:41:25 -0000
@@ -74,7 +74,17 @@
       // A side effect of defining it this way is that if we're called for an
       // embedded node, with no teaser or page, we use the full version's settings.
       // That is by design.
-      $mode = $teaser ? 'teaser' : 'full';
+
+      if isset($node->build_mode) {
+        $mode = $node->build_mode;
+        if ($mode === NODE_BUILD_NORMAL) {
+          $mode = $teaser ? 'teaser' : 'full';
+        }
+      }
+      else {
+        $mode = 'full';
+      }
+
       $views = views_attach_get_node_views($node->type, $mode);
       foreach ($views as $info) {
         $view = views_get_view($info['name']);
@@ -166,14 +176,10 @@
       $views = views_get_applicable_views('uses hook nodeapi');
       foreach ($views as $data) {
         list($view, $display_id) = $data;
-        $full = $view->display_handler->get_option('full');
-        $teaser = $view->display_handler->get_option('teaser');
         foreach ($view->display_handler->get_option('types') as $type_to_use) {
-          if ($full) {
-            $used_views[$type_to_use]['full'][] = array('name' => $view->name, 'display' => $display_id, 'title' => $view->get_title());
-          }
-          if ($teaser) {
-            $used_views[$type_to_use]['teaser'][] = array('name' => $view->name, 'display' => $display_id, 'title' => $view->get_title());
+          $modes = $view->display_handler->get_option('modes');
+          foreach ($modes as $mode => $value) {
+            $used_views[$type_to_use][$mode][] = array('name' => $view->name, 'display' => $display_id, 'title' => $view->get_title());
           }
         }
         $view->destroy();
@@ -182,10 +188,26 @@
     }
   }
 
-  if (empty($mode)) {
+  if (is_null($mode)) {
     return isset($used_views[$type]) ? $used_views[$type] : array();
   }
   else {
     return isset($used_views[$type][$mode]) ? $used_views[$type][$mode] : array();
   }
 }
+
+function views_attach_build_modes() {
+  $modes = array();
+  if (module_exists('content')) {
+    foreach (content_build_modes() as $mode => $value) {
+      $modes[$mode] = $value['title'];
+    }
+  }
+  else {
+    $modes = array(
+      'full' => 'Full',
+      'teaser'  => 'Teaser',
+    );
+  }
+  return $modes;
+}
\ No newline at end of file
Index: views_attach_plugin_display_node_content.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_attach/views_attach_plugin_display_node_content.inc,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 views_attach_plugin_display_node_content.inc
--- views_attach_plugin_display_node_content.inc	20 Jan 2009 21:44:38 -0000	1.1.2.1
+++ views_attach_plugin_display_node_content.inc	27 Jan 2009 21:41:56 -0000
@@ -9,8 +9,7 @@
     $options = parent::option_definition();
 
     $options['types'] = array('default' => array());
-    $options['teaser'] = array('default' => FALSE);
-    $options['full'] = array('default' => TRUE);
+    $options['modes'] = array('default' => array('full'));
 
     return $options;
   }
@@ -39,26 +38,11 @@
       'value' => implode(', ', $types),
     );
 
-    $teaser = $this->get_option('teaser');
-    if (empty($teaser)) {
-      $teaser = FALSE;
-    }
 
-    $options['teaser'] = array(
+    $options['modes'] = array(
       'category' => 'node_content',
-      'title' => t('Show on teaser'),
-      'value' => $teaser ? t('True') : t('False'),
-    );
-
-    $full = $this->get_option('full');
-    if (empty($full)) {
-      $full = FALSE;
-    }
-
-    $options['full'] = array(
-      'category' => 'node_content',
-      'title' => t('Show on full view'),
-      'value' => $full ? t('True') : t('False'),
+      'title' => t('Build modes'),
+      'value' => implode(', ', $this->get_option('modes')),
     );
 
     $weight = $this->get_option('weight');
@@ -87,38 +71,30 @@
         );
         break;
 
-      case 'teaser':
-        $form['#title'] .= t('Teaser view');
-        $form['teaser'] = array(
-          '#type' => 'checkbox',
-          '#title' => t("Show this view on the node's teaser"),
-          '#default_value' => $this->get_option('teaser'),
-        );
-        break;
-
-      case 'full':
-        $form['#title'] .= t('Full view');
-        $form['full'] = array(
-          '#type' => 'checkbox',
-          '#title' => t("Show this view on the node's full view"),
-          '#default_value' => $this->get_option('full'),
+      case 'modes':
+        $form['#title'] .= t('Build modes');
+        $form['modes'] = array(
+          '#type' => 'checkboxes',
+          '#title' => t("Embed this display in the following build modes"),
+          '#options' => views_attach_build_modes(),
+          '#default_value' => $this->get_option('modes'),
         );
         break;
-      }
+    }
   }
 
   function options_submit($form, &$form_state) {
     // It is very important to call the parent function here:
     parent::options_submit($form, $form_state);
+
     switch ($form_state['section']) {
       case 'types':
         $this->set_option('types', $form_state['values']['types']);
         break;
-      case 'teaser':
-        $this->set_option('teaser', $form_state['values']['teaser']);
-        break;
-      case 'full':
-        $this->set_option('full', $form_state['values']['full']);
+
+      case 'modes':
+        $this->set_option('modes', $form_state['values']['modes']);
+
         break;
     }
   }
