Commit 881b79f7 authored by targoo's avatar targoo

reorder functions / remove unused variables

parent ee542597
...@@ -5,12 +5,29 @@ ...@@ -5,12 +5,29 @@
* Date administration code. * Date administration code.
*/ */
/**
* Helper function for color_field_field_settings_form().
*/
function _color_field_field_settings_form($field, $instance, $has_data) {
$field_settings = $field['settings'];
$form = array();
$form['opacity'] = array(
'#type' => 'checkbox',
'#title' => t('Record opacity'),
'#default_value' => $field_settings['opacity'],
'#description' => t('If checked, the opacity will be recorded.'),
);
return $form;
}
/** /**
* Helper function for color_field_field_instance_settings_form(). * Helper function for color_field_field_instance_settings_form().
*/ */
function _color_field_field_instance_settings_form($field, $instance) { function _color_field_field_instance_settings_form($field, $instance) {
$widget = $instance['widget']; $widget = $instance['widget'];
$settings = $instance['settings']; $instance_settings = $instance['settings'];
$form = array(); $form = array();
...@@ -20,19 +37,19 @@ function _color_field_field_instance_settings_form($field, $instance) { ...@@ -20,19 +37,19 @@ function _color_field_field_instance_settings_form($field, $instance) {
$form['show_input'] = array( $form['show_input'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Show Input'), '#title' => t('Show Input'),
'#default_value' => $settings['show_input'], '#default_value' => $instance_settings['show_input'],
'#description' => t('Allow free form typing.'), '#description' => t('Allow free form typing.'),
); );
$form['show_palette'] = array( $form['show_palette'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Show Palette'), '#title' => t('Show Palette'),
'#default_value' => $settings['show_palette'], '#default_value' => $instance_settings['show_palette'],
'#description' => t('Show or hide Palette in Spectrum Widget'), '#description' => t('Show or hide Palette in Spectrum Widget'),
); );
$form['palette'] = array( $form['palette'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Color Palette'), '#title' => t('Color Palette'),
'#default_value' => $settings['palette'], '#default_value' => $instance_settings['palette'],
'#description' => t('Selectable color palette to accompany the Spectrum Widget'), '#description' => t('Selectable color palette to accompany the Spectrum Widget'),
'#states' => array( '#states' => array(
'visible' => array( 'visible' => array(
...@@ -43,19 +60,19 @@ function _color_field_field_instance_settings_form($field, $instance) { ...@@ -43,19 +60,19 @@ function _color_field_field_instance_settings_form($field, $instance) {
$form['show_palette_only'] = array( $form['show_palette_only'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Show Palette Only'), '#title' => t('Show Palette Only'),
'#default_value' => $settings['show_palette_only'], '#default_value' => $instance_settings['show_palette_only'],
'#description' => t('Only show thePalette in Spectrum Widget and nothing else'), '#description' => t('Only show thePalette in Spectrum Widget and nothing else'),
); );
$form['show_buttons'] = array( $form['show_buttons'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Show Buttons'), '#title' => t('Show Buttons'),
'#default_value' => $settings['show_buttons'], '#default_value' => $instance_settings['show_buttons'],
'#description' => t('Add Cancel/Confirm Button.'), '#description' => t('Add Cancel/Confirm Button.'),
); );
$form['allow_empty'] = array( $form['allow_empty'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Allow Empty'), '#title' => t('Allow Empty'),
'#default_value' => $settings['allow_empty'], '#default_value' => $instance_settings['allow_empty'],
'#description' => t('Allow empty value.'), '#description' => t('Allow empty value.'),
); );
break; break;
...@@ -65,7 +82,7 @@ function _color_field_field_instance_settings_form($field, $instance) { ...@@ -65,7 +82,7 @@ function _color_field_field_instance_settings_form($field, $instance) {
$form['default_colors'] = array( $form['default_colors'] = array(
'#type' => 'textarea', '#type' => 'textarea',
'#title' => t('Default colors'), '#title' => t('Default colors'),
'#default_value' => $settings['default_colors'], '#default_value' => $instance_settings['default_colors'],
'#required' => TRUE, '#required' => TRUE,
'#description' => t('Default colors for pre-selected color boxes'), '#description' => t('Default colors for pre-selected color boxes'),
); );
...@@ -78,42 +95,42 @@ function _color_field_field_instance_settings_form($field, $instance) { ...@@ -78,42 +95,42 @@ function _color_field_field_instance_settings_form($field, $instance) {
$form['cell_width'] = array( $form['cell_width'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Cell width'), '#title' => t('Cell width'),
'#default_value' => $settings['cell_width'], '#default_value' => $instance_settings['cell_width'],
'#required' => TRUE, '#required' => TRUE,
'#description' => t('Width of each individual color cell.'), '#description' => t('Width of each individual color cell.'),
); );
$form['cell_height'] = array( $form['cell_height'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Height width'), '#title' => t('Height width'),
'#default_value' => $settings['cell_height'], '#default_value' => $instance_settings['cell_height'],
'#required' => TRUE, '#required' => TRUE,
'#description' => t('Height of each individual color cell.'), '#description' => t('Height of each individual color cell.'),
); );
$form['cell_margin'] = array( $form['cell_margin'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Cell margin'), '#title' => t('Cell margin'),
'#default_value' => $settings['cell_margin'], '#default_value' => $instance_settings['cell_margin'],
'#required' => TRUE, '#required' => TRUE,
'#description' => t('Margin of each individual color cell.'), '#description' => t('Margin of each individual color cell.'),
); );
$form['box_width'] = array( $form['box_width'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Box width'), '#title' => t('Box width'),
'#default_value' => $settings['box_width'], '#default_value' => $instance_settings['box_width'],
'#required' => TRUE, '#required' => TRUE,
'#description' => t('Width of the color display box.'), '#description' => t('Width of the color display box.'),
); );
$form['box_height'] = array( $form['box_height'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Box height'), '#title' => t('Box height'),
'#default_value' => $settings['box_height'], '#default_value' => $instance_settings['box_height'],
'#required' => TRUE, '#required' => TRUE,
'#description' => t('Height of the color display box.'), '#description' => t('Height of the color display box.'),
); );
$form['columns'] = array( $form['columns'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Columns number'), '#title' => t('Columns number'),
'#default_value' => $settings['columns'], '#default_value' => $instance_settings['columns'],
'#required' => TRUE, '#required' => TRUE,
'#description' => t('Number of columns to display. Color order may look strange if this is altered.'), '#description' => t('Number of columns to display. Color order may look strange if this is altered.'),
); );
...@@ -123,30 +140,10 @@ function _color_field_field_instance_settings_form($field, $instance) { ...@@ -123,30 +140,10 @@ function _color_field_field_instance_settings_form($field, $instance) {
return $form; return $form;
} }
/**
* Helper function for color_field_field_settings_form().
*/
function _color_field_field_settings_form($field, $instance, $has_data) {
$widget = $instance['widget'];
$settings = $field['settings'];
$form = array();
$form['opacity'] = array(
'#type' => 'checkbox',
'#title' => t('Record opacity'),
'#default_value' => $settings['opacity'],
'#description' => t('If checked, the opacity will be recorded.'),
);
return $form;
}
/** /**
* Helper function for color_field_field_settings_form(). * Helper function for color_field_field_settings_form().
*/ */
function _color_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) { function _color_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
// Current widget.
$widget = $instance['widget']; $widget = $instance['widget'];
$field_settings = $field['settings']; $field_settings = $field['settings'];
$instance_settings = $instance['settings']; $instance_settings = $instance['settings'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment