You are here

function asset_admin_formatter_defaults in Asset 6

Same name and namespace in other branches
  1. 5 asset.module \asset_admin_formatter_defaults()

Menu callback for selection of default formatting options.

1 string reference to 'asset_admin_formatter_defaults'
asset_menu in ./asset.module
Implementation of hook_menu()

File

inc/asset.admin.inc, line 47

Code

function asset_admin_formatter_defaults() {
  $form = array();
  $formatters = asset_get_formatters(true);
  foreach ($formatters as $type => $exts) {
    $form[$type] = array(
      '#type' => 'fieldset',
      '#title' => $type == '*' ? t('All Types') : $type,
      '#tree' => false,
    );
    foreach ($exts as $ext => $formats) {
      $form[$type]['asset_default_formatter_' . $type . '_' . $ext] = array(
        '#type' => 'select',
        '#title' => $ext,
        '#options' => asset_formatter_options($type, $ext),
        '#default_value' => asset_get_default_formatter($type, $ext, false),
      );
      $form[$type]['asset_default_formatter_teaser_' . $type . '_' . $ext] = array(
        '#type' => 'select',
        '#title' => $ext,
        '#options' => asset_formatter_options($type, $ext),
        '#default_value' => asset_get_default_formatter($type, $ext, true),
      );
    }
  }
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['buttons']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset to defaults'),
  );
  if (!empty($_POST) && form_get_errors()) {
    drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');
  }
  $form['#submit'][] = 'system_settings_form_submit';

  //theme('asset_admin_formatter_defaults', $form);
  return $form;
}