You are here

function minisite_field_instance_settings_form in Mini site 7

Implements hook_field_instance_settings_form().

File

includes/minisite.field.inc, line 47
Minisite field.

Code

function minisite_field_instance_settings_form($field, $instance) {
  $settings = $instance['settings'];
  $form['max_filesize'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum upload size'),
    '#default_value' => $settings['max_filesize'],
    '#description' => t('Enter a value like "512" (bytes), "80 KB" (kilobytes) or "50 MB" (megabytes) in order to restrict the allowed file size. If left empty the file sizes will be limited only by PHP\'s maximum post and file upload sizes (current limit <strong>%limit</strong>).', array(
      '%limit' => format_size(file_upload_max_size()),
    )),
    '#size' => 10,
    '#element_validate' => array(
      '_file_generic_settings_max_filesize',
    ),
    '#weight' => 5,
  );

  // Make the extension list a little more human-friendly by comma-separation.
  $extensions = str_replace(' ', ', ', $settings['minisite_extensions']);
  $form['minisite_extensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Allowed file extensions in uploaded minisite files'),
    '#default_value' => $extensions,
    '#description' => t('Separate extensions with a space or comma and do not include the leading dot.'),
    '#element_validate' => array(
      '_minisite_field_validate_minisite_file_settings',
    ),
    // By making this field required, we prevent a potential security issue
    // that would allow files of any type to be uploaded.
    '#required' => TRUE,
    '#maxlength' => 255,
    '#weight' => 11,
  );
  return $form;
}