function block_upload_block_configure in Block Upload 7
Implements hook_block_configure().
File
- ./
block_upload.module, line 54 - Block Upload module.
Code
function block_upload_block_configure($delta = '') {
$form = array();
$blocks_count = variable_get('block_upload_blocks_count', 1);
for ($i = 1; $i <= $blocks_count; $i++) {
if ($delta == 'block_upload_' . $i) {
$fields = block_upload_get_field_list();
$form['block_upload_' . $i . '_field'] = array(
'#type' => 'select',
'#title' => t('Field'),
'#description' => t('Select field you wish to upload file.'),
'#options' => $fields,
'#default_value' => array(
variable_get('block_upload_' . $i . '_field', ''),
),
'#ajax' => array(
'callback' => 'block_upload_ajax_callback',
'wrapper' => 'config',
'effect' => 'fade',
),
);
$form['block_upload_id'] = array(
'#type' => 'textfield',
'#default_value' => $i,
'#access' => FALSE,
);
// Add field additional display options.
$field_name = variable_get('block_upload_' . $i . '_field', '');
$field = field_info_field($field_name);
_block_upload_field_options_form_elements($form, $i, $field['type']);
// Check if plupload module exists and displau enable option.
if (module_exists('plupload')) {
$settings = variable_get('block_upload_' . $i . '_settings', array());
$form['block_upload_' . $i . '_plupload_status'] = array(
'#type' => 'checkbox',
'#title' => t('Use Plupoad for file uploads'),
'#default_value' => isset($settings['plupload']) ? $settings['plupload'] : 0,
);
}
else {
$link = l(t('Plupload integration'), 'https://drupal.org/project/plupload', array(
'external' => TRUE,
'attributes' => array(
'target' => '_blank',
),
));
$description = t('To enable multiuploads and drag&drop upload features, download and install !link module', array(
'!link' => $link,
));
$form['block_upload_plupload_status'] = array(
'#type' => 'checkbox',
'#title' => t('Use Plupoad for file uploads'),
'#disabled' => TRUE,
'#description' => $description,
);
}
}
}
return $form;
}