You are here

function imce_form_admin_form in IMCE 5

return the form for admin/settings/imce

1 string reference to 'imce_form_admin_form'
imce_form_admin in ./imce.module
return the form for admin/settings/imce

File

./imce.module, line 647

Code

function imce_form_admin_form() {
  $roles = imce_sorted_roles();
  $form['#tree'] = TRUE;
  $form['common'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#title' => t('Common settings'),
  );
  $form['common']['tinymce'] = module_exists('tinymce') ? array(
    '#type' => 'checkbox',
    //tinymce support
    '#title' => '<strong>' . t('Enable tinyMCE support') . '</strong>',
    '#default_value' => variable_get('imce_settings_tinymce', 1),
    '#description' => t('Make IMCE the default image/file browser for tinyMCE.'),
  ) : NULL;
  $form['common']['fck'] = module_exists('fckeditor') ? array(
    '#type' => 'checkbox',
    //fck support
    '#title' => '<strong>' . t('Enable FCKEditor support') . '</strong>',
    '#default_value' => variable_get('imce_settings_fck', 0),
    '#description' => t('Replace the built-in file browser of FCKeditor with IMCE.'),
  ) : NULL;
  if (variable_get('file_downloads', '') == FILE_DOWNLOADS_PRIVATE) {
    $form['common']['disable_private'] = array(
      '#type' => 'checkbox',
      '#title' => t('Disable serving of private files'),
      '#default_value' => variable_get('imce_settings_disable_private', 0),
      '#description' => t('By default 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 default behavior.'),
    );
  }
  $form['common']['textarea'] = array(
    '#type' => 'textfield',
    //plain textarea support
    '#title' => t('Enable inline image/file insertion into plain textareas'),
    '#default_value' => variable_get('imce_settings_textarea', ''),
    '#maxlength' => 255,
    '#description' => t('This feature allows you to add your images or files as <strong>html code into any plain textarea</strong>. This is useful especially when you dont use a wysiwyg editor such as tinyMCE or FCKeditor. Enter <strong>comma separated textarea IDs</strong> if you want to enable this feature. Otherwise, leave it blank. Hint: ID of Body fields in most node types is edit-body.'),
  );
  if (count($roles) > 1) {

    //role precedence settings appear if there is more than 1 role.
    $rids = $rtext = array();
    foreach ($roles as $rid => $name) {
      $rids[] = $rid;
      $rtext[] = '<strong>' . $rid . '-)</strong>' . $name;
    }
    $form['common']['rank'] = array(
      '#type' => 'textfield',
      '#title' => t('Role precedence'),
      '#default_value' => implode('>', $rids),
      '#description' => t('A user having <strong>multiple roles</strong> gets the permissions of the highest one. Sort role IDs according to their <strong>precedence from higher to lower</strong> by putting > in between. Here is the id-name pairs of roles having access to IMCE:') . '<div>' . implode(', ', $rtext) . '</div>',
    );
  }
  if ($GLOBALS['user']->uid == 1) {

    //user #1 settings.
    $form['user1'] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#title' => t('Settings for user #1'),
    ) + imce_form_template('user1');
  }
  foreach ($roles as $rid => $name) {

    //role settings
    $form['roles'][$rid] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#title' => t('Settings for the role: !role', array(
        '!role' => $name,
      )),
    ) + imce_form_template($rid);
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}