# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/video_filter_field.module
+++ b/video_filter_field.module
@@ -12,7 +12,7 @@
       'label' => t('Video Filter'),
       'description' => t('This field stores URLs and settings to be '
                        . 'handled by the Video Filter module.'),
-      'settings' => array(),
+      'settings' => array('width_height' => 'allow'),
       'instance_settings' => array(
         'max_height' => 400,
         'max_width' => 400,
@@ -99,6 +99,7 @@
         //  'message'  => t('Video Filter Field: Invalid video URL'),
         //);
         // If URL isn't empty, we need a height.
+        if ($field['settings']['width_height'] == 'allow') {
         if (empty($item['height']) || !is_numeric($item['height'])) {
           $errors[$field['field_name']][$langcode][$delta][] = array( 
             'error' => 'video_filter_height',
@@ -113,6 +114,7 @@
           );
         }
       } 
+      }
       // URL field is empty. Set everything else to empty.
       else {
         unset($items);    
@@ -151,6 +153,7 @@
   //dsm($instance,' instance');
   
   if ($instance['widget']['type'] == 'video_filter') {
+    if ($field['settings']['width_height'] == 'allow') {
     $element['url'] = array(
       '#type' => 'textfield',
       '#title' => t('Video URL'),
@@ -180,10 +183,35 @@
       '#weight' => 3,
     ) + $base;
   }
+    else {
+    $element['url'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Video URL'),
+      '#default_value' => isset($items[$delta]['url']) ? 
+                          $items[$delta]['url'] : NULL,
+      '#weight' => 0,
+      ) + $base;      
+    }
+  }
   return $element;
 }
 
 /**
+ * Implements hook_field_settings_form().
+ */
+function video_filter_field_field_settings_form($field, $instance, $has_data) {
+  $settings = $field['settings'];
+  $form['width_height'] = array(
+    '#title' => t('Should the user be allowed to enter in their own width and height or will this be managed by the display formatter?'),
+    '#type' => 'select',
+    '#options' => array('allow' => t('Allow user to enter video display dimensions'), 'dont' => t('Do not allow user to enter video display dimensions')),
+    '#default_value' => $settings['width_height'],
+    '#weight' => 0,
+  );
+  return $form;
+}
+
+/**
  * Implements hook_field_formatter_info().
  */
 function video_filter_field_field_formatter_info() { 
@@ -192,10 +220,77 @@
       'label' => t('Video Filter'),
       'field types' => array('text', 'video_filter'),
     ),
+    'video_filter_field_custom' => array(
+      'label' => t('Video Filter Custom'), 
+      'field types' => array('text', 'video_filter'),
+      'settings' => array('custom_height' => '400','custom_width' => '400','custom_autoplay' => '0'),
+    ),
   );
 } 
 
 /**
+ * Implements hook_field_formatter_settings_form()
+ */
+function video_filter_field_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
+  $display = $instance['display'][$view_mode];
+  $settings = $display['settings'];
+  $element = array();
+  
+  if ($display['type'] == 'video_filter_field_custom') {  
+  $element['custom_width'] = array(
+    '#title' => t('Width'),
+    '#type' => 'textfield',
+    '#size' => 4,
+    '#default_value' => $settings['custom_width'],
+    '#description' => t('Specify width'),
+    '#tree' => TRUE,
+    '#weight' => 1,
+    '#element_validate' => array('element_validate_integer_positive'), 
+    '#required' => TRUE,
+    );
+  $element['custom_height'] = array(
+    '#title' => t('Height'),
+    '#type' => 'textfield',
+    '#size' => 4,
+    '#default_value' => $settings['custom_height'],
+    '#description' => t('Specify height'),
+    '#tree' => TRUE,
+    '#weight' => 2,
+    '#element_validate' => array('element_validate_integer_positive'), 
+    '#required' => TRUE,
+    );
+  $element['custom_autoplay'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Autoplay'),
+    '#default_value' => $settings['custom_autoplay'],
+    '#description' => t('Autoplay?'),
+    '#tree' => TRUE,
+    '#weight' => 3,
+    );
+  }
+  return $element;
+}
+
+/**
+ * Implements hook_field_formatter_settings_summary().
+ */
+function video_filter_field_field_formatter_settings_summary($field, $instance, $view_mode) {
+  $view = $instance['display'][$view_mode];
+
+  $info = '';
+
+  $settings = $view['settings'];
+
+  $width = '<b>' . $settings['custom_width'] . '</b>';
+  $height = '<b>' . $settings['custom_height'] . '</b>';
+  $autoplay = '<b>' . $settings['custom_autoplay'] . '</b>';
+  if ($view['type'] == 'video_filter_field_custom') {
+  $info =  t('Video display width: !width<br>Video display height: !height<br>Video display autoplay: !autoplay', array('!width' => $width,'!height' => $height,'!autoplay' => $autoplay));
+  }
+  return $info;
+}
+
+/**
  * Implements hook_field_formatter_view().
  */
 function video_filter_field_field_formatter_view($obj_type, $object, $field, 
@@ -212,20 +307,42 @@
 dsm($items,'items');
 // */
 
-  $elements = array();
+  $element = array();
+  $settings = $display['settings'];
+
+  switch ($display['type']) {
+    case 'video_filter_field_default':
   foreach ($items as $delta => $item) {
     $url = url($item['url']);
     $text = "[video:$url]";
 
-    $elements[$delta] = array(
+        $element[$delta] = array(
       '#theme' => 'video_filter_field_default_formatter',
       '#item' => video_filter_field_process($text, $item),
     );
   }
+      break;
 
-  return $elements;
+    case 'video_filter_field_custom':
+      foreach ($items as $delta => $item) {
+        $width = $settings['custom_width'];
+        $height = $settings['custom_height'];
+        $autoplay = $settings['custom_autoplay'];
+        $url = url($item['url']);
+        $text = "[video:$url width:$width height:$height autoplay:$autoplay]";
+        
+        $element[$delta] = array(
+          '#theme' => 'video_filter_field_default_formatter',
+          '#item' => video_filter_field_process($text, $item),
+        );
 }
+      break;
+   }
 
+  return $element;
+
+ }
+
 /**
  * Implements hook_theme().
  */

