function mediafront_preset_form in MediaFront 6.2
Same name and namespace in other branches
- 6 includes/mediafront.preset.inc \mediafront_preset_form()
- 7.2 includes/mediafront.preset.inc \mediafront_preset_form()
- 7 includes/mediafront.preset.inc \mediafront_preset_form()
1 string reference to 'mediafront_preset_form'
- mediafront_preset_menu in includes/
mediafront.preset.inc - Implement the menu system for the preset.
File
- includes/
mediafront.preset.inc, line 149
Code
function mediafront_preset_form(&$form_state, $preset) {
$form['preview'] = array(
'#type' => 'fieldset',
'#title' => t('Player Preview'),
'#attributes' => array(
'id' => 'mediafront_admin_preview',
),
'#weight' => -10,
);
// Set up the parameters for the player.
$preset = (array) $preset;
$params = array(
'admin' => true,
'player' => $preset['player'],
'preset' => $preset['name'],
);
$params = $preset['settings'] ? array_merge($preset['settings'], $params) : $params;
$form['preview']['player'] = array(
'#type' => 'markup',
'#value' => mediafront_get_player($params),
);
// Get all of the settings for this player.
$preset['settings'] = mediafront_get_settings($preset['player'], $params);
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Preset Settings'),
'#attributes' => array(
'id' => 'mediafront_admin_settings',
),
'#weight' => -9,
'#collapsible' => false,
'#collapsed' => false,
);
$form['settings']['preset'] = array(
'#type' => 'fieldset',
'#title' => t('Preset Information'),
'#weight' => -9,
'#collapsible' => true,
'#collapsed' => true,
);
if (isset($preset['pid'])) {
$form['settings']['preset']['pid'] = array(
'#type' => 'value',
'#value' => $preset['pid'],
);
}
$form['settings']['preset']['name'] = array(
'#type' => 'value',
'#value' => $preset['name'],
);
$form['settings']['preset']['description'] = array(
'#type' => 'textfield',
'#title' => t('Description'),
'#description' => t('Add a brief description to your preset name.'),
'#default_value' => $preset['description'],
'#weight' => -9,
);
$form['settings']['preset']['player'] = array(
'#type' => 'value',
'#value' => $preset['player'],
);
$form['settings']['player_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Player Settings'),
'#weight' => -8,
'#collapsible' => true,
'#collapsed' => true,
'#tree' => TRUE,
);
// Now add the player settings form to this fieldset.
$form['settings']['player_settings'] = array_merge(mediafront_player_settings_form($preset), $form['settings']['player_settings']);
// Add the player to player settings.
$form['settings']['connect'] = array(
'#type' => 'fieldset',
'#title' => t('Player to Player'),
'#collapsible' => true,
'#collapsed' => true,
);
$result = mediafront_preset_get_presets();
$presets = array();
foreach ($result as $pid => $otherPreset) {
if ($otherPreset['name'] != $preset['name']) {
$presets[$otherPreset['name']] = $otherPreset['name'];
}
}
if (isset($preset['connect']) && $preset['connect']) {
$form['settings']['connect']['iscontroller'] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#title' => t('Make this preset the Control Bar for'),
'#description' => t('Select which preset you would like to control using this preset.'),
'#default_value' => $preset['connect']['iscontroller'],
'#options' => $presets,
);
$form['settings']['connect']['isplaylist'] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#title' => t('Make this preset the Playlist for'),
'#description' => t('Select which preset you would like to play this playlist.'),
'#default_value' => $preset['connect']['isplaylist'],
'#options' => $presets,
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Preset'),
'#weight' => 30,
);
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#weight' => 40,
'#submit' => array(
'mediafront_preset_delete_submit',
),
);
// Add the form submit handler.
$form['#submit'][] = 'mediafront_preset_submit';
$form['#validate'][] = 'mediafront_preset_validate';
return $form;
}