You are here

function imce_admin_form in IMCE 7

Same name and namespace in other branches
  1. 6.2 inc/imce.admin.inc \imce_admin_form()
  2. 6 inc/admin.inc \imce_admin_form()

Admin form.

1 string reference to 'imce_admin_form'
imce_admin in inc/imce.admin.inc
Admin main page.

File

inc/imce.admin.inc, line 81
Serves administration pages of IMCE.

Code

function imce_admin_form($form, &$form_state) {

  // Roles profiles.
  $form['roles'] = array(
    '#tree' => TRUE,
  );
  $roles = imce_sorted_roles();
  $form['#weighted'] = count($roles) > 3;
  foreach ($roles as $rid => $role) {
    $core = $rid == DRUPAL_ANONYMOUS_RID || $rid == DRUPAL_AUTHENTICATED_RID;
    $form['roles'][$rid] = imce_role_form($role, $form['#weighted'], $core);
  }

  // Common settings.
  $form['common'] = array(
    '#type' => 'fieldset',
    '#title' => t('Common settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['common']['textarea'] = array(
    '#type' => 'textfield',
    '#title' => t('Enable inline image/file insertion into plain textareas'),
    '#default_value' => variable_get('imce_settings_textarea', ''),
    '#maxlength' => NULL,
    '#description' => t("If you don't use any WYSIWYG editor, this feature will allow you to add your images or files as <strong>html code into any plain textarea</strong>. Enter <strong>comma separated textarea IDs</strong> under which you want to enable a link to IMCE. The * character is a wildcard. Hint: ID of Body fields in most node types starts with edit-body*."),
  );
  $form['common']['absurls'] = array(
    '#type' => 'checkbox',
    '#title' => t('Absolute URLs'),
    '#default_value' => variable_get('imce_settings_absurls', 0),
    '#description' => t('Check if you want IMCE to return absolute file URLs.'),
  );
  $form['common']['image_metadata'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable image metada'),
    '#default_value' => variable_get('imce_disable_image_info', 0),
    '#description' => t('Disabling the metadata fetch may speed up IMCE on S3 or slow NFS sites with lots of files in the initial directory.'),
  );
  $form['common']['replace'] = array(
    '#type' => 'radios',
    '#title' => t('Default behaviour for existing files during file uploads'),
    '#default_value' => variable_get('imce_settings_replace', FILE_EXISTS_RENAME),
    '#options' => array(
      FILE_EXISTS_RENAME => t('Keep the existing file renaming the new one'),
      FILE_EXISTS_ERROR => t('Keep the existing file rejecting the new one'),
      FILE_EXISTS_REPLACE => t('Replace the existing file with the new one'),
      IMCE_RENAME_REPLACE => t('Let the user decide which option to choose'),
    ),
  );
  $form['common']['sort'] = array(
    '#type' => 'radios',
    '#title' => t('Default file sort when IMCE is opened'),
    '#default_value' => variable_get('imce_settings_sort', 'default'),
    '#options' => array(
      'default' => t('First sort by name and then will sort by the last option the user used'),
      'by_name' => t('Sort by name'),
      'by_size' => t('Sort by size'),
      'by_date' => t('Sort by date'),
    ),
  );
  $form['common']['thumb_method'] = array(
    '#type' => 'radios',
    '#title' => t('Default method for creating thumbnails'),
    '#default_value' => variable_get('imce_settings_thumb_method', 'scale_and_crop'),
    '#options' => array(
      'scale' => t('Scale the image with respect to the thumbnail dimensions.'),
      'scale_and_crop' => t('First scale then crop the image to fit the thumbnail dimensions.'),
    ),
  );
  $form['common']['disable_private'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable serving of private files'),
    '#default_value' => variable_get('imce_settings_disable_private', 1),
    '#description' => t('IMCE serves all files under private files directory without applying any access restrictions. This allows anonymous access to any file(/system/files/filename) unless there is a module restricting access to the files. Here you can disable this feature.'),
  );
  $form['common']['admin_theme'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use admin theme for IMCE paths'),
    '#default_value' => variable_get('imce_settings_admin_theme', FALSE),
    '#description' => t('If you have user interface issues with the active theme you may consider switching to admin theme.'),
  );
  $form['common']['imce_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Provide a menu link to IMCE'),
    '#description' => t('Provide menu link so the user can just manager the files in admin/content/imce.'),
    '#default_value' => variable_get('imce_settings_menu_link', 1),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['#theme'] = 'imce_admin';
  $form['#submit'][] = 'imce_admin_submit';
  return $form;
}