You are here

function ml_image_settings in Media Library 6

Settings form for Media Library settings page

1 string reference to 'ml_image_settings'
ml_image_media_types in ml_image/ml_image.module
Implementation of hook_media_types()

File

ml_image/ml_image.module, line 425
Media Library Image module.

Code

function ml_image_settings($form_state) {
  $form = array();

  // General settings
  $form['main'] = array(
    '#type' => 'fieldset',
    '#title' => t('General Settings'),
    '#collapsible' => TRUE,
  );

  // Get imagecache data
  $presets = imagecache_presets();
  $options = array();
  foreach ($presets as $preset) {
    $options[$preset['presetname']] = $preset['presetname'];
  }
  $options['none'] = t('Original Size');
  $form['main']['ml_image_imagecache_presets'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Imagecache presets'),
    '#description' => t('Select wich imagecache presets should be available for the user to insert an image'),
    '#options' => $options,
    '#default_value' => variable_get('ml_image_imagecache_presets', array(
      0,
    )),
    '#required' => TRUE,
  );

  // Term relationship
  $vocabularies = taxonomy_get_vocabularies();
  $options = array();
  foreach ($vocabularies as $vid => $data) {
    $options[$vid] = $data->name;
  }
  array_unshift($options, t('<< None >>'));
  $form['main']['ml_image_vocabulary'] = array(
    '#type' => 'select',
    '#title' => t('Vocabulary for term relation'),
    '#description' => t('Use this to be able to select tags to images'),
    '#options' => $options,
    '#default_value' => array(
      variable_get('ml_image_vocabulary', 0),
    ),
  );

  // Sources settings
  $sources = ml_image_get_sources();
  foreach ($sources as $source => $info) {
    if (isset($info['settings'])) {
      $form_func = $info['settings'];
      if (function_exists($form_func)) {
        $form['sources'][$type] = $form_func($form_state);
        $form['sources'][$type] += array(
          '#type' => 'fieldset',
          '#title' => 'Source: ' . $info['label'],
          '#collapsible' => TRUE,
        );
      }
    }
  }
  return system_settings_form($form);
}