You are here

function filefield_sources_form in FileField Sources 6

Same name and namespace in other branches
  1. 8 filefield_sources.module \filefield_sources_form()
  2. 7 filefield_sources.module \filefield_sources_form()

Configuration form for editing FileField Sources settings for a widget.

1 call to filefield_sources_form()
filefield_sources_widget_settings_alter in ./filefield_sources.module
Implements hook_widget_settings_alter().

File

./filefield_sources.module, line 89
Extend FileField to allow files from multiple sources.

Code

function filefield_sources_form($widget) {
  $settings = $widget;
  $form['filefield_sources'] = array(
    '#type' => 'fieldset',
    '#title' => t('File sources'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 15,
  );
  $sources = filefield_sources_list(FALSE);
  $sources = isset($settings['filefield_sources']) ? array_intersect_key(array_merge($settings['filefield_sources'], $sources), $sources) : $sources;
  $form['filefield_sources']['filefield_sources'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Enabled sources'),
    '#options' => $sources,
    '#default_value' => isset($settings['filefield_sources']) ? $settings['filefield_sources'] : array(),
    '#description' => t('Select the available locations from which this widget may select files.'),
  );
  $params = array(
    'form',
    $settings,
  );
  $form['filefield_sources'] = array_merge($form['filefield_sources'], filefield_sources_invoke_all('settings', $params));
  return $form;
}