function mp3player_player_form in MP3 Player 6.2
Same name and namespace in other branches
- 7.2 mp3player.module \mp3player_player_form()
Custom submit function for the system settings form. Form to edit a player.
1 string reference to 'mp3player_player_form'
- mp3player_menu in ./
mp3player.module - Implementation of hook_menu().
File
- ./
mp3player.module, line 186 - mp3player main module file.
Code
function mp3player_player_form($form_state, $pid = NULL) {
if ($pid) {
$player = mp3player_players($pid);
}
else {
$player = mp3player_players(1);
$player['name'] = '';
$player['pid'] = 0;
}
$form['namegroup'] = array(
'#type' => 'fieldset',
'#title' => t('Player Name'),
'#weight' => -2,
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$form['namegroup']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#default_value' => $player['name'],
'#required' => TRUE,
'#size' => '20',
'#description' => t('Unique name of player. Please only use alphanumeric characters, or underscores (_) for player names.'),
);
if ($pid == 1) {
$form['namegroup']['#type'] = 'hidden';
$form['namegroup']['name']['#type'] = 'hidden';
}
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Player Options'),
'#weight' => -1,
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$form['options']['autostart'] = array(
'#type' => 'select',
'#title' => t('Auto-start'),
'#default_value' => $player['autostart'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('If yes, player starts automatically.'),
);
$form['options']['loopaudio'] = array(
'#type' => 'select',
'#title' => t('Loop Audio'),
'#default_value' => $player['loopaudio'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('If yes, player loops audio.'),
);
$form['options']['animation'] = array(
'#type' => 'select',
'#title' => t('Animate'),
'#default_value' => $player['animation'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('If no, player is always open.'),
);
$form['options']['remaining'] = array(
'#type' => 'select',
'#title' => t('Time Remaining'),
'#default_value' => $player['remaining'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('If yes, shows remaining track time rather than elapsed time.'),
);
$form['options']['noinfo'] = array(
'#type' => 'select',
'#title' => t("Don't display information"),
'#default_value' => $player['noinfo'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('If yes, disables the track information display.'),
);
$form['options']['initialvolume'] = array(
'#type' => 'textfield',
'#title' => t('Initial Volume'),
'#default_value' => $player['initialvolume'],
'#required' => TRUE,
'#size' => '10',
'#description' => t('Initial volume level (from 0 to 100).'),
);
$form['options']['buffer'] = array(
'#type' => 'textfield',
'#title' => t('Buffer Time'),
'#default_value' => $player['buffer'],
'#required' => TRUE,
'#size' => '10',
'#description' => t('Buffering time in seconds.'),
);
$form['options']['encode'] = array(
'#type' => 'select',
'#title' => t('Encode'),
'#default_value' => $player['encode'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('Indicates that the mp3 file urls are encoded.'),
);
$form['options']['checkpolicy'] = array(
'#type' => 'select',
'#title' => t('Check Policy'),
'#default_value' => $player['checkpolicy'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('Tells Flash to look for a policy file when loading mp3 files (this allows Flash to read ID3 tags from files hosted on a different domain).'),
);
$form['options']['rtl'] = array(
'#type' => 'select',
'#title' => t('Text Right-to-Left'),
'#default_value' => $player['rtl'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('Switches the layout to RTL (right to left) for Hebrew and Arabic languages.'),
);
$form['options']['width'] = array(
'#type' => 'textfield',
'#title' => t('Player Width'),
'#default_value' => $player['width'],
'#required' => TRUE,
'#size' => '10',
'#description' => t('Width of the player. e.g. 290 (290 pixels) or 100%.'),
);
$form['options']['transparentpagebg'] = array(
'#type' => 'select',
'#title' => t('Transparent Player Background'),
'#default_value' => $player['transparentpagebg'],
'#options' => array(
'no' => t('No'),
'yes' => t('Yes'),
),
'#description' => t('If yes, the player background is transparent (matches the page background).'),
);
$form['options']['pagebg'] = array(
'#type' => 'textfield',
'#title' => t('Player Background Colour'),
'#default_value' => $player['pagebg'],
'#required' => FALSE,
'#size' => '20',
'#field_prefix' => '#',
'#description' => t("Player background colour (set it to your page background when transparentbg is set to 'no')."),
);
$form['colours'] = array(
'#type' => 'fieldset',
'#title' => t('Player Colour Scheme'),
'#weight' => 0,
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$form['colours']['bg'] = array(
'#type' => 'textfield',
'#title' => t('Background'),
'#default_value' => $player['bg'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['leftbg'] = array(
'#type' => 'textfield',
'#title' => t('Left Background'),
'#default_value' => $player['leftbg'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
'#description' => t('Speaker icon/Volume control background.'),
);
$form['colours']['lefticon'] = array(
'#type' => 'textfield',
'#title' => t('Speaker Icon'),
'#default_value' => $player['lefticon'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['voltrack'] = array(
'#type' => 'textfield',
'#title' => t('Volume Track Background'),
'#default_value' => $player['voltrack'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['volslider'] = array(
'#type' => 'textfield',
'#title' => t('Volume Track Slider'),
'#default_value' => $player['volslider'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['rightbg'] = array(
'#type' => 'textfield',
'#title' => t('Right Background'),
'#default_value' => $player['rightbg'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
'#description' => t('Play/Pause button background.'),
);
$form['colours']['rightbghover'] = array(
'#type' => 'textfield',
'#title' => t('Right Background Hover'),
'#default_value' => $player['rightbghover'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
'#description' => t('Play/Pause button background (hover state).'),
);
$form['colours']['righticon'] = array(
'#type' => 'textfield',
'#title' => t('Play/Pause Icon'),
'#default_value' => $player['righticon'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['righticonhover'] = array(
'#type' => 'textfield',
'#title' => t('Play/Pause Icon (hover state)'),
'#default_value' => $player['righticonhover'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['loader'] = array(
'#type' => 'textfield',
'#title' => t('Loading Bar'),
'#default_value' => $player['loader'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['track'] = array(
'#type' => 'textfield',
'#title' => t('Track Backgrounds'),
'#default_value' => $player['track'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
'#description' => t('Loading/Progress bar track background.'),
);
$form['colours']['tracker'] = array(
'#type' => 'textfield',
'#title' => t('Progress Track'),
'#default_value' => $player['tracker'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['border'] = array(
'#type' => 'textfield',
'#title' => t('Progress Track Border'),
'#default_value' => $player['border'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['skip'] = array(
'#type' => 'textfield',
'#title' => t('Previous/Next Buttons'),
'#default_value' => $player['skip'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['colours']['text'] = array(
'#type' => 'textfield',
'#title' => t('Text'),
'#default_value' => $player['text'],
'#required' => TRUE,
'#size' => '10',
'#field_prefix' => '#',
);
$form['pid'] = array(
'#type' => 'hidden',
'#value' => $player['pid'],
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save changes to player'),
);
return $form;
}