function scald_admin_contexts_form in Scald: Media Management made easy 6
Same name and namespace in other branches
- 7 includes/scald.admin.inc \scald_admin_contexts_form()
Form for admin settings for Scald Contexts.
1 string reference to 'scald_admin_contexts_form'
- scald_admin_contexts in ./
scald.admin.inc - The Scald Admin page for Scald Contexts.
File
- ./
scald.admin.inc, line 279
Code
function scald_admin_contexts_form() {
$form = array();
$scald_config = variable_get('scald_config', 0);
// Build the Context editing form per-context
$contexts_results = db_query("\n SELECT\n c.*\n FROM\n {scald_contexts} c\n ORDER BY\n c.title\n ");
while ($context_raw = db_fetch_array($contexts_results)) {
$context = $context_raw['context'];
$form[$context] = array(
'#type' => 'fieldset',
'#title' => $context_raw['title'],
'#description' => $context_raw['description'] . '<br>' . t('Provided by <code>@module.module</code>.', array(
'@module' => $context_raw['provider'],
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form[$context][$context . '_pars'] = array(
'#type' => 'checkbox',
'#title' => t('Make parseable.'),
'#default_value' => (bool) $context_raw['parseable'],
);
// Build the Transcoder editing form per-type
$form[$context]['transcoders'] = array(
'#type' => 'fieldset',
'#title' => t('Transcoders for %context by Atom Type', array(
'%context' => $context,
)),
'#collapsible' => FALSE,
);
foreach ($scald_config->types as $type => $details) {
// Build the array of Transcoder options
$transcoders = array();
$transcoders['@none'] = t('None');
$transcoders['passthrough@passthrough'] = t('Passthrough');
$transcoder_results = db_query("\n SELECT\n t.transcoder AS transcoder,\n t.title AS title,\n tf.file_format AS file_format\n FROM\n {scald_transcoders} t\n LEFT JOIN\n {scald_transcoder_formats} tf\n ON tf.transcoder = t.transcoder\n WHERE\n tf.file_format IN (SELECT file_format FROM {scald_context_type_formats} WHERE context='%s')\n ", $context);
while ($transcoder_raw = db_fetch_array($transcoder_results)) {
$transcoders[$transcoder_raw['transcoder'] . '@' . $transcoder_raw['file_format']] = $transcoder_raw['title'];
}
$form[$context]['transcoders'][$context . '@' . $type . '_type'] = array(
'#type' => 'select',
'#title' => $scald_config->types[$type]['title'],
'#default_value' => !empty($scald_config->contexts[$context]['type_format']) && !empty($scald_config->contexts[$context]['type_format'][$type]) ? $scald_config->contexts[$context]['type_format'][$type]['transcoder'] . '@' . $scald_config->contexts[$context]['type_format'][$type]['file_format'] : '@none',
'#options' => $transcoders,
);
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}