You are here

asset.admin.inc in Asset 6

File

inc/asset.admin.inc
View source
<?php

/**
 * Admin Settings
 */
function asset_admin_settings() {
  global $__asset_path;
  $form['asset_access_option'] = array(
    '#type' => 'radios',
    '#title' => t('Visibility Options'),
    '#default_value' => variable_get('asset_access_option', 1),
    '#options' => array(
      t('Show on every page except the listed pages.'),
      t('Show on only the listed pages.'),
      t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).'),
    ),
  );
  $form['asset_access_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => variable_get('asset_access_pages', "node/add/*\r\nnode/*/edit"),
    '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are 'blog' for the blog page and blog/* for every personal blog. <front> is the front page.If the PHP-mode is chosen, enter PHP code between <?php ?>. Note that executing incorrect PHP-code can break your Drupal site. Also note that if you are using a WYSIWYG editor, the asset button may be available in that editor regardless of this setting."),
  );
  $form['asset_wizard_theme'] = array(
    '#type' => 'fieldset',
    '#title' => t('Wizard theme'),
    '#theme' => 'asset_wizard_theme_form',
  );
  $paths = array(
    $__asset_path . '/misc/themes',
    drupal_get_path('theme', variable_get('theme_default', 'garland')),
  );
  foreach ($paths as $path) {
    $files = file_scan_directory($path, 'asset_wizard\\.css$');
    foreach ($files as $filename => $file) {
      $form['asset_wizard_theme'][$filename] = array(
        '#type' => 'radio',
        '#return_value' => $filename,
        '#default_value' => variable_get('asset_wizard_theme', drupal_get_path('module', 'asset') . '/themes/default/asset_wizard.css'),
        '#parents' => array(
          'asset_wizard_theme',
        ),
      );
    }
  }
  return system_settings_form($form);
}

/**
 * Menu callback for selection of default formatting options.
 */
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;
}

Functions

Namesort descending Description
asset_admin_formatter_defaults Menu callback for selection of default formatting options.
asset_admin_settings Admin Settings