--- popup_filter.module	2010-06-30 21:39:17.000000000 +0200
+++ popup_filter.module.new	2010-08-07 20:33:52.293372913 +0200
@@ -140,12 +140,6 @@ function popup_filter_insert_form(){
   $form_ids = variable_get('form-registry', array());
   $form_ids = array_combine($form_ids, $form_ids);
 
-  $views = views_get_all_views();
-  $views_options = array();
-  foreach($views as $view){
-    $views_options[$view->name] = $view->name;
-  }
-
   $form = array(
 
     'popup_id' => array(
@@ -304,8 +298,15 @@ function popup_filter_insert_form(){
       ),
 
     ),
+  );
 
-    'popup_content_view' => array(
+  if (module_exists('views')) {
+    $views = views_get_all_views();
+    $views_options = array();
+    foreach($views as $view) {
+      $views_options[$view->name] = $view->name;
+    }
+    $form['popup_content_view'] = array(
       '#prefix' => '<div class="popup-content-view popup-content-section">',
       '#suffix' => '</div>',
 
@@ -327,9 +328,10 @@ function popup_filter_insert_form(){
         '#type' => 'textfield',
       ),
 
-    ),
+    );
+  }
 
-    'popup_content_php' => array(
+    $form['popup_content_php'] = array(
       '#prefix' => '<div class="popup-content-php popup-content-section">',
       '#suffix' => '</div>',
 
@@ -339,19 +341,17 @@ function popup_filter_insert_form(){
         '#type' => 'textarea',
       ),
 
-    ),
+    );
 
-    array(
+    $form[] = array(
       '#value' => '</div>',
-    ),
+    );
 
-    'popup_insert' => array(
+    $form['popup_insert'] = array(
       '#prefix' => '<div class="popup-insert">',
       '#suffix' => '</div>',
       '#value' => '<p class="description">'.t('Please ensure that the input format is set to "Popup filter", or that the current input format includes a popup filter.') . '</p><input type="button" value="' . t('Insert') . '" />',
-    ),
-
-  );
+    );
 
   if (module_exists('views')){
     $form['popup_type']['#options']['view'] = 'View';
