file_field_settings_form

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 file_field_settings_form($field, $instance, $has_data)

Implements hook_field_settings_form().

Code

modules/file/file.field.inc, line 36

<?php
function file_field_settings_form($field, $instance, $has_data) {
  $defaults = field_info_field_settings($field['type']);
  $settings = array_merge($defaults, $field['settings']);

  $form['#attached']['js'][] = drupal_get_path('module', 'file') . '/file.js';

  $form['display_field'] = array(
    '#type' => 'checkbox', 
    '#title' => t('Enable <em>Display</em> field'), 
    '#default_value' => $settings['display_field'], 
    '#description' => t('The display option allows users to choose if a file should be shown when viewing the content.'),
  );
  $form['display_default'] = array(
    '#type' => 'checkbox', 
    '#title' => t('Files displayed by default'), 
    '#default_value' => $settings['display_default'], 
    '#description' => t('This setting only has an effect if the display option is enabled.'),
  );

  $scheme_options = array();
  foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $stream_wrapper) {
    $scheme_options[$scheme] = $stream_wrapper['name'];
  }
  $form['uri_scheme'] = array(
    '#type' => 'radios', 
    '#title' => t('Upload destination'), 
    '#options' => $scheme_options, 
    '#default_value' => $settings['uri_scheme'], 
    '#description' => t('Select where the final files should be stored. Private file storage has significantly more overhead than public files, but allows restricted access to files within this field.'), 
    '#disabled' => $has_data,
  );

  return $form;
}
?>