### Eclipse Workspace Patch 1.0
#P webform
Index: components/date.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/date.inc,v
retrieving revision 1.29.2.12
diff -u -r1.29.2.12 date.inc
--- components/date.inc 19 Aug 2010 03:00:45 -0000 1.29.2.12
+++ components/date.inc 27 Sep 2010 18:52:33 -0000
@@ -19,6 +19,7 @@
'mandatory' => 0,
'email' => 1,
'extra' => array(
+ 'title_display' => 0,
'timezone' => 'user',
'year_start' => '-2',
'year_end' => '+2',
@@ -70,7 +71,6 @@
'#weight' => 1,
'#access' => variable_get('configurable_timezones', 1) && module_exists('date_timezone'),
);
-
$form['display']['datepicker'] = array(
'#type' => 'checkbox',
'#title' => t('Enable popup calendar'),
@@ -89,6 +89,14 @@
'#weight' => 5,
'#parents' => array('extra', 'year_textfield'),
);
+ $form['display']['title_display'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide the title'),
+ '#default_value' => $component['extra']['title_display'],
+ '#return_value' => 'none',
+ '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+ '#parents' => array('extra', 'title_display'),
+ );
$form['validation']['year_start'] = array(
'#type' => 'textfield',
@@ -143,6 +151,10 @@
$element['#default_value'] = $value;
}
+ // Required to implement the #title_display option.
+ $element['#pre_render'] = array('_webform_client_form_title_display');
+ $element['#title_display'] = empty($component['extra']['title_display']) ? NULL : $component['extra']['title_display'];
+
return $element;
}
Index: components/email.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/email.inc,v
retrieving revision 1.28.2.4
diff -u -r1.28.2.4 email.inc
--- components/email.inc 10 Apr 2010 00:54:57 -0000 1.28.2.4
+++ components/email.inc 27 Sep 2010 18:52:34 -0000
@@ -20,6 +20,7 @@
'email' => 1,
'extra' => array(
'width' => '',
+ 'title_display' => 0,
'unique' => 0,
'disabled' => 0,
'description' => '',
@@ -72,6 +73,14 @@
'#maxlength' => 10,
'#parents' => array('extra', 'width'),
);
+ $form['display']['title_display'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide the title'),
+ '#default_value' => $component['extra']['title_display'],
+ '#return_value' => 'none',
+ '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+ '#parents' => array('extra', 'title_display'),
+ );
$form['display']['disabled'] = array(
'#type' => 'checkbox',
'#title' => t('Disabled'),
@@ -142,6 +151,10 @@
$element['#size'] = $component['extra']['width'];
}
+ // Required to implement the #title_display option.
+ $element['#pre_render'] = array('_webform_client_form_title_display');
+ $element['#title_display'] = empty($component['extra']['title_display']) ? NULL : $component['extra']['title_display'];
+
return $element;
}
Index: components/file.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/file.inc,v
retrieving revision 1.17.2.6
diff -u -r1.17.2.6 file.inc
--- components/file.inc 18 Sep 2010 05:37:44 -0000 1.17.2.6
+++ components/file.inc 27 Sep 2010 18:52:36 -0000
@@ -25,6 +25,7 @@
),
'savelocation' => '',
'width' => '',
+ 'title_display' => 0,
'description' => '',
'attributes' => array(),
),
@@ -145,6 +146,14 @@
'#weight' => 4,
'#parents' => array('extra', 'width')
);
+ $form['display']['title_display'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide the title'),
+ '#default_value' => $component['extra']['title_display'],
+ '#return_value' => 'none',
+ '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+ '#parents' => array('extra', 'title_display'),
+ );
return $form;
}
@@ -318,6 +327,9 @@
$element['#theme'] = 'webform_render_file';
$element['#prefix'] = '
';
$element['#suffix'] = '
';
+ // Required to implement the #title_display option.
+ $element['#pre_render'] = array('_webform_client_form_title_display');
+ $element['#title_display'] = empty($component['extra']['title_display']) ? NULL : $component['extra']['title_display'];
// Change the 'width' option to the correct 'size' option.
Index: components/select.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/select.inc,v
retrieving revision 1.39.2.20
diff -u -r1.39.2.20 select.inc
--- components/select.inc 10 Sep 2010 17:41:17 -0000 1.39.2.20
+++ components/select.inc 27 Sep 2010 18:52:38 -0000
@@ -22,6 +22,7 @@
'items' => '',
'multiple' => NULL,
'aslist' => NULL,
+ 'title_display' => 0,
'optrand' => 0,
'other_option' => NULL,
'other_text' => t('Other...'),
@@ -163,6 +164,15 @@
'#description' => t('Check this option if you want the select component to be of listbox type instead of radio buttons or checkboxes.'),
'#parents' => array('extra', 'aslist'),
);
+ $form['display']['title_display'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide the title'),
+ '#default_value' => $component['extra']['title_display'],
+ '#return_value' => 'none',
+ '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+ '#parents' => array('extra', 'title_display'),
+ );
+
$form['display']['optrand'] = array(
'#type' => 'checkbox',
'#title' => t('Randomize options'),
@@ -355,6 +365,10 @@
}
}
+ // Required to implement the #title_display option.
+ $element['#pre_render'] = array('_webform_client_form_title_display');
+ $element['#title_display'] = empty($component['extra']['title_display']) ? NULL : $component['extra']['title_display'];
+
$element['#prefix'] = '';
$element['#suffix'] = '
';
Index: components/textarea.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/textarea.inc,v
retrieving revision 1.20.2.3
diff -u -r1.20.2.3 textarea.inc
--- components/textarea.inc 21 Mar 2010 03:38:12 -0000 1.20.2.3
+++ components/textarea.inc 27 Sep 2010 18:52:38 -0000
@@ -23,6 +23,7 @@
'rows' => '',
'resizable' => 1,
'disabled' => 0,
+ 'title_display' => 0,
'description' => '',
'attributes' => array(),
),
@@ -81,6 +82,14 @@
'#default_value' => $component['extra']['resizable'],
'#parents' => array('extra', 'resizable'),
);
+ $form['display']['title_display'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide the title'),
+ '#default_value' => $component['extra']['title_display'],
+ '#return_value' => 'none',
+ '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+ '#parents' => array('extra', 'title_display'),
+ );
$form['display']['disabled'] = array(
'#type' => 'checkbox',
'#title' => t('Disabled'),
@@ -112,6 +121,10 @@
'#suffix' => '',
);
+ // Required to implement the #title_display option.
+ $element['#pre_render'] = array('_webform_client_form_title_display');
+ $element['#title_display'] = empty($component['extra']['title_display']) ? NULL : $component['extra']['title_display'];
+
if ($component['extra']['disabled']) {
$element['#attributes']['readonly'] = 'readonly';
}
Index: components/textfield.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/textfield.inc,v
retrieving revision 1.21.2.3
diff -u -r1.21.2.3 textfield.inc
--- components/textfield.inc 21 Mar 2010 03:38:12 -0000 1.21.2.3
+++ components/textfield.inc 27 Sep 2010 18:52:39 -0000
@@ -20,6 +20,7 @@
'email' => 1,
'extra' => array(
'width' => '',
+ 'title_display' => 0,
'maxlength' => '',
'field_prefix' => '',
'field_suffix' => '',
@@ -86,6 +87,14 @@
'#weight' => 1.2,
'#parents' => array('extra', 'field_suffix'),
);
+ $form['display']['title_display'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide the title'),
+ '#default_value' => $component['extra']['title_display'],
+ '#return_value' => 'none',
+ '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+ '#parents' => array('extra', 'title_display'),
+ );
$form['display']['disabled'] = array(
'#type' => 'checkbox',
'#title' => t('Disabled'),
@@ -136,6 +145,9 @@
'#webform_component' => $component,
'#element_validate' => array(),
);
+ // Required to implement the #title_display option.
+ $element['#pre_render'] = array('_webform_client_form_title_display');
+ $element['#title_display'] = empty($component['extra']['title_display']) ? NULL : $component['extra']['title_display'];
if ($component['extra']['disabled']) {
$element['#attributes']['readonly'] = 'readonly';
Index: components/time.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/time.inc,v
retrieving revision 1.24.2.10
diff -u -r1.24.2.10 time.inc
--- components/time.inc 19 Aug 2010 03:00:45 -0000 1.24.2.10
+++ components/time.inc 27 Sep 2010 18:52:40 -0000
@@ -24,6 +24,7 @@
'extra' => array(
'timezone' => 'user',
'hourformat' => '12-hour',
+ 'title_display' => 0,
'description' => '',
),
);
@@ -75,6 +76,15 @@
'#weight' => 2,
'#parents' => array('extra', 'hourformat'),
);
+ $form['display']['title_display'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide the title'),
+ '#default_value' => $component['extra']['title_display'],
+ '#return_value' => 'none',
+ '#description' => t('This hides the title of the form component when they are displayed in the form.'),
+ '#parents' => array('extra', 'title_display'),
+ );
+
return $form;
}
@@ -138,6 +148,10 @@
'#webform_component' => $component,
);
+ // Required to implement the #title_display option.
+ $element['#pre_render'] = array('_webform_client_form_title_display');
+ $element['#title_display'] = empty($component['extra']['title_display']) ? NULL : $component['extra']['title_display'];
+
$element['hour'] = array(
'#prefix' => '',
'#type' => 'select',
Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.196.2.54
diff -u -r1.196.2.54 webform.module
--- webform.module 8 Sep 2010 05:23:47 -0000 1.196.2.54
+++ webform.module 27 Sep 2010 18:52:32 -0000
@@ -1500,6 +1500,13 @@
return $form;
}
+function _webform_client_form_title_display($element) {
+ if (isset($element['#title_display']) && $element['#title_display'] === 'none') {
+ $element['#title'] = NULL;
+ }
+ return $element;
+}
+
/**
* Check if a component should be displayed on the current page.
*/