You are here

function filefield_source_imce_settings in FileField Sources 7

Same name and namespace in other branches
  1. 6 sources/imce.inc \filefield_source_imce_settings()

Implements hook_filefield_source_settings().

File

sources/imce.inc, line 65
A FileField extension to allow referencing of files from IMCE.

Code

function filefield_source_imce_settings($op, $instance) {
  $return = array();
  if ($op == 'form') {
    $settings = $instance['widget']['settings']['filefield_sources'];
    $return['source_imce'] = array(
      '#title' => t('IMCE file browser settings'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#access' => module_exists('imce'),
    );
    $return['source_imce']['imce_mode'] = array(
      '#type' => 'radios',
      '#title' => t('File browser mode'),
      '#options' => array(
        0 => t('Restricted: Users can only browse the field directory. No file operations are allowed.'),
        1 => t('Full: Browsable directories are defined by <a href="!imce-admin-url">IMCE configuration profiles</a>. File operations are allowed.', array(
          '!imce-admin-url' => url('admin/config/media/imce'),
        )),
      ),
      '#default_value' => isset($settings['source_imce']['imce_mode']) ? $settings['source_imce']['imce_mode'] : 0,
    );
  }
  elseif ($op == 'save') {
    $return['source_imce']['imce_mode'] = 0;
  }
  return $return;
}