aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--types/videoupload/videoupload.field.inc98
-rw-r--r--video.module4
2 files changed, 11 insertions, 91 deletions
diff --git a/types/videoupload/videoupload.field.inc b/types/videoupload/videoupload.field.inc
index 01edac9..d7d4d31 100644
--- a/types/videoupload/videoupload.field.inc
+++ b/types/videoupload/videoupload.field.inc
@@ -1,4 +1,5 @@
<?php
+
// $Id$
/**
@@ -59,7 +60,6 @@ function videoupload_field_settings_form($field, $instance) {
);
return $form;
-
}
/**
@@ -71,84 +71,9 @@ function videoupload_field_instance_settings_form($field, $instance) {
// Use the file field instance settings form as a basis.
$form = file_field_instance_settings_form($field, $instance);
- // Add maximum and minimum resolution settings.
- $max_resolution = explode('x', $settings['max_resolution']) + array('', '');
- $form['max_resolution'] = array(
- '#type' => 'item',
- '#title' => t('Maximum image resolution'),
- '#element_validate' => array('_image_field_resolution_validate'),
- '#weight' => 4.1,
- '#field_prefix' => '<div class="container-inline">',
- '#field_suffix' => '</div>',
- '#description' => t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Leave blank for no restriction. If a larger image is uploaded, it will be resized to reflect the given width and height. Resizing images on upload will cause the loss of <a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format">EXIF data</a> in the image.'),
- );
- $form['max_resolution']['x'] = array(
- '#type' => 'textfield',
- '#title' => t('Maximum width'),
- '#title_display' => 'invisible',
- '#default_value' => $max_resolution[0],
- '#size' => 5,
- '#maxlength' => 5,
- '#field_suffix' => ' x ',
- );
- $form['max_resolution']['y'] = array(
- '#type' => 'textfield',
- '#title' => t('Maximum height'),
- '#title_display' => 'invisible',
- '#default_value' => $max_resolution[1],
- '#size' => 5,
- '#maxlength' => 5,
- '#field_suffix' => ' ' . t('pixels'),
- );
-
- $min_resolution = explode('x', $settings['min_resolution']) + array('', '');
- $form['min_resolution'] = array(
- '#type' => 'item',
- '#title' => t('Minimum image resolution'),
- '#element_validate' => array('_image_field_resolution_validate'),
- '#weight' => 4.2,
- '#field_prefix' => '<div class="container-inline">',
- '#field_suffix' => '</div>',
- '#description' => t('The minimum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Leave blank for no restriction. If a smaller image is uploaded, it will be rejected.'),
- );
- $form['min_resolution']['x'] = array(
- '#type' => 'textfield',
- '#title' => t('Minimum width'),
- '#title_display' => 'invisible',
- '#default_value' => $min_resolution[0],
- '#size' => 5,
- '#maxlength' => 5,
- '#field_suffix' => ' x ',
- );
- $form['min_resolution']['y'] = array(
- '#type' => 'textfield',
- '#title' => t('Minimum height'),
- '#title_display' => 'invisible',
- '#default_value' => $min_resolution[1],
- '#size' => 5,
- '#maxlength' => 5,
- '#field_suffix' => ' ' . t('pixels'),
- );
-
- // Remove the description option.
- unset($form['description_field']);
-
- // Add title and alt configuration options.
- $form['alt_field'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable <em>Alt</em> field'),
- '#default_value' => $settings['alt_field'],
- '#description' => t('The alt attribute may be used by search engines, screen readers, and when the image cannot be loaded.'),
- '#weight' => 10,
- );
- $form['title_field'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable <em>Title</em> field'),
- '#default_value' => $settings['title_field'],
- '#description' => t('The title attribute is used as a tooltip when the mouse hovers over the image.'),
- '#weight' => 11,
- );
-
+ //default settings
+ $default = video_default_widget_settings($widget);
+ $form = $form + $default;
return $form;
}
@@ -169,8 +94,7 @@ function _video_field_resolution_validate($element, &$form_state) {
}
}
form_set_value($element, intval($element['x']['#value']) . 'x' . intval($element['y']['#value']), $form_state);
- }
- else {
+ } else {
form_set_value($element, '', $form_state);
}
}
@@ -317,8 +241,7 @@ function videoupload_field_widget_form(&$form, &$form_state, $field, $instance,
if (empty($elements[0]['#default_value']['fid'])) {
$elements[0]['#description'] = theme('file_upload_help', array('description' => $instance['description'], 'upload_validators' => $elements[0]['#upload_validators']));
}
- }
- else {
+ } else {
$elements['#file_upload_description'] = theme('file_upload_help', array('upload_validators' => $elements[0]['#upload_validators']));
}
return $elements;
@@ -465,8 +388,7 @@ function videoupload_field_formatter_settings_summary($field, $instance, $view_m
// their styles in code.
if (isset($image_styles[$settings['image_style']])) {
$summary[] = t('Image style: @style', array('@style' => $image_styles[$settings['image_style']]));
- }
- else {
+ } else {
$summary[] = t('Original image');
}
@@ -491,8 +413,7 @@ function videoupload_field_formatter_view($entity_type, $entity, $field, $instan
// Check if the formatter involves a link.
if ($display['settings']['image_link'] == 'content') {
$uri = entity_uri($entity_type, $entity);
- }
- elseif ($display['settings']['image_link'] == 'file') {
+ } elseif ($display['settings']['image_link'] == 'file') {
$link_file = TRUE;
}
@@ -539,8 +460,7 @@ function theme_videoupload_formatter($variables) {
if ($variables['image_style']) {
$image['style_name'] = $variables['image_style'];
$output = theme('image_style', $image);
- }
- else {
+ } else {
$output = theme('image', $image);
}
diff --git a/video.module b/video.module
index 36119d2..ce3e6d5 100644
--- a/video.module
+++ b/video.module
@@ -815,7 +815,7 @@ function video_default_widget_settings($widget) {
'#type' => 'fieldset',
'#title' => t('Video Advanced Settings'),
'#collapsible' => TRUE,
- '#collapsed' => FALSE,
+ '#collapsed' => TRUE,
'#weight' => 10
);
$form['plugins']['default_dimensions'] = array(
@@ -845,7 +845,7 @@ function video_default_widget_settings($widget) {
'#title' => t('Video Thumbnail Settings'),
'#element_validate' => array('video_default_widget_settings_validate'),
'#collapsible' => TRUE,
- '#collapsed' => FALSE,
+ '#collapsed' => TRUE,
'#weight' => 11
);