function flowplayer3_scheme_form in SWF Tools 6.2
Helper function to produce the color scheme form for the flowplayer
1 call to flowplayer3_scheme_form()
- flowplayer3_admin_settings in flowplayer3/
flowplayer3.admin.inc - Menu callback for the FlowPlayer3 settings form.
1 string reference to 'flowplayer3_scheme_form'
- flowplayer3_admin_settings in flowplayer3/
flowplayer3.admin.inc - Menu callback for the FlowPlayer3 settings form.
File
- flowplayer3/
flowplayer3.admin.inc, line 489
Code
function flowplayer3_scheme_form(&$form_state) {
// Get path to the flowplayer3 module
$base = drupal_get_path('module', 'flowplayer3');
// Add Farbtastic color picker
drupal_add_css('misc/farbtastic/farbtastic.css');
drupal_add_js('misc/farbtastic/farbtastic.js');
// Add custom CSS/JS
drupal_add_css($base . '/flowplayer3.colorpicker.css');
drupal_add_js($base . '/flowplayer3.colorpicker.js');
drupal_add_js(array(
'color' => array(
'reference' => flowplayer3_get_palette(true),
),
), 'setting');
// Get info about the current theme color scheme
$info = flowplayer3_get_info();
// See if we're using a predefined scheme
// The variable is empty if using the default, or an array of key/value pairs otherwise
$current = implode(',', variable_get('flowplayer3_palette', array()));
// Note: we use the original theme when the default scheme is chosen.
$current = isset($info['schemes'][$current]) ? $current : ($current == '' ? reset($info['schemes']) : '');
// Add custom to scheme selector options
$info['schemes'][''] = t('Custom');
// Add scheme selector to form (the value is a comma separated string of hex colors)
$form['flowplayer3_scheme'] = array(
'#type' => 'select',
'#title' => t('Color set'),
'#options' => $info['schemes'],
'#default_value' => $current,
);
// Get current palette as an array
$palette = flowplayer3_get_palette();
// Build an array of titles to be used for each palette element
$names = array(
'backgroundColor' => array(
'#title' => t('Background color'),
),
'controlbarbackgroundColor' => array(
'#title' => t('Control bar background color'),
),
'timeColor' => array(
'#title' => t('Elapsed time font color'),
),
'durationColor' => array(
'#title' => t('Total time font color'),
),
'progressColor' => array(
'#title' => t('Progress bar color'),
),
'bufferColor' => array(
'#title' => t('Buffer color'),
),
'sliderColor' => array(
'#title' => t('Slider color'),
),
'buttonColor' => array(
'#title' => t('Button color'),
),
'buttonOverColor' => array(
'#title' => t('Button over color'),
),
);
// Form elements to be part of a tree
$form['flowplayer3_palette']['#tree'] = true;
// Cycle through each palette element
foreach ($palette as $name => $value) {
$form['flowplayer3_palette'][$name] = array(
'#type' => 'textfield',
'#title' => $names[$name]['#title'],
'#default_value' => $value,
'#size' => 8,
);
}
// Return the form
return $form;
}