function uc_file_feature_settings in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_file/uc_file.module \uc_file_feature_settings()
- 6.2 uc_file/uc_file.module \uc_file_feature_settings()
Form builder for file settings.
See also
uc_file_feature_settings_validate()
uc_file_feature_settings_submit()
1 string reference to 'uc_file_feature_settings'
- uc_file_uc_product_feature in uc_file/
uc_file.module - Implements hook_uc_product_feature().
File
- uc_file/
uc_file.module, line 837 - Allows products to be associated with downloadable files.
Code
function uc_file_feature_settings($form, &$form_state) {
$statuses = array();
foreach (uc_order_status_list('general') as $status) {
$statuses[$status['id']] = $status['title'];
}
$form['uc_file_base_dir'] = array(
'#type' => 'textfield',
'#title' => t('Files path'),
'#description' => t('The absolute path (or relative to Drupal root) where files used for file downloads are located. For security reasons, it is recommended to choose a path outside the web root.'),
'#default_value' => variable_get('uc_file_base_dir', NULL),
);
$form['uc_file_duplicate_warning'] = array(
'#type' => 'checkbox',
'#title' => t('Warn about purchasing duplicate files'),
'#description' => t("If a customer attempts to purchase a product containing a file download, warn them and notify them that the download limits will be added onto their current limits."),
'#default_value' => variable_get('uc_file_duplicate_warning', TRUE),
);
$form['uc_file_download_limit'] = array(
'#type' => 'fieldset',
'#title' => t('Default download limits'),
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$form['uc_file_download_limit']['uc_file_download_limit_number'] = array(
'#type' => 'textfield',
'#title' => t('Downloads'),
'#description' => t("The number of times a file can be downloaded. Leave empty to set no limit."),
'#default_value' => variable_get('uc_file_download_limit_number', NULL),
'#maxlength' => 4,
'#size' => 4,
);
$form['uc_file_download_limit']['uc_file_download_limit_addresses'] = array(
'#type' => 'textfield',
'#title' => t('IP addresses'),
'#description' => t("The number of unique IPs that a file can be downloaded from. Leave empty to set no limit."),
'#default_value' => variable_get('uc_file_download_limit_addresses', NULL),
'#maxlength' => 4,
'#size' => 4,
);
$form['uc_file_download_limit']['uc_file_download_limit_duration_qty'] = array(
'#type' => 'textfield',
'#title' => t('Time'),
'#default_value' => variable_get('uc_file_download_limit_duration_qty', NULL),
'#size' => 4,
'#maxlength' => 4,
'#prefix' => '<div class="duration">',
'#suffix' => '</div>',
'#states' => array(
'disabled' => array(
'select[name="uc_file_download_limit_duration_granularity"]' => array(
'value' => 'never',
),
),
),
);
$form['uc_file_download_limit']['uc_file_download_limit_duration_granularity'] = array(
'#type' => 'select',
'#options' => array(
'never' => t('never'),
'day' => t('day(s)'),
'week' => t('week(s)'),
'month' => t('month(s)'),
'year' => t('year(s)'),
),
'#default_value' => variable_get('uc_file_download_limit_duration_granularity', 'never'),
'#description' => t('How long after a product has been purchased until its file download expires.'),
'#prefix' => '<div class="duration">',
'#suffix' => '</div>',
);
return $form;
}