function asset_wizard_default_fields in Asset 6
Same name in this branch
- 6 asset_wizard.inc \asset_wizard_default_fields()
- 6 inc/asset_wizard.inc \asset_wizard_default_fields()
Same name and namespace in other branches
- 5 asset_wizard.inc \asset_wizard_default_fields()
This is the base form for asset types.
4 calls to asset_wizard_default_fields()
- asset_wizard_form in ./
asset_wizard.inc - Main form builder function for the asset wizard.
- asset_wizard_form in inc/
asset_wizard.inc - Main form builder function for the asset wizard.
- asset_wizard_form_asset_selection in ./
asset_wizard.inc - Form builder for step 1 of the asset wizard. This step is the most intensive so it has been separated out for clarity.
- asset_wizard_form_asset_selection in inc/
asset_wizard.inc - Form builder for step 1 of the asset wizard. This step is the most intensive so it has been separated out for clarity.
File
- ./
asset_wizard.inc, line 554
Code
function asset_wizard_default_fields($form_values) {
$parentdir = $form_values['parent'] ? $form_values['parent'] : $_GET['dir'];
$parentdir = trim(str_replace(file_directory_path(), '', $parentdir), '/');
$parent = asset_load(array(
'dirname' => dirname($parentdir),
'filename' => basename($parentdir),
));
$form['parent'] = array(
'#type' => 'hidden',
'#value' => file_create_path($form_values['parent'] ? $form_values['parent'] : $_GET['dir']),
);
$form['parent'] = array(
'#type' => 'select',
'#title' => t('Directory'),
'#default_value' => $form_values['parent'] ? $form_values['parent'] : $_GET['dir'],
'#options' => asset_wizard_directory_options(),
'#weight' => -5,
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
);
$form['author'] = array(
'#type' => 'textfield',
'#title' => t('Author'),
);
$form['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#rows' => 3,
);
$form['permissions'] = array(
'#theme' => 'asset_upload_permissions',
'#tree' => false,
);
$default_status = 1;
if (isset($form_values['aid']) && is_numeric($form_values['aid'])) {
$default_status = db_result(db_query("SELECT status FROM {asset} WHERE aid=%d LIMIT 1", $form_values['aid']));
}
$form['permissions']['status'] = array(
'#type' => 'radios',
'#title' => t('Permissions'),
'#description' => t('Select the permissions for this asset. Selecting Public will allow anyone with asset permissions to use this asset. By selecting Private, you can restrict which roles, if any, can access this asset. If you select Private and do not select any roles, you will be the only user with access to this asset.'),
'#required' => true,
'#default_value' => $default_status,
'#options' => array(
ASSET_PUBLIC => t('Public'),
ASSET_PRIVATE => t('Private'),
),
);
$form['permissions']['roles'] = array(
'#type' => 'checkboxes',
'#options' => user_roles(0, 'create assets'),
'#default_value' => $parent->roles,
);
$form['preview'] = array(
'#type' => 'hidden',
'#value' => $preview,
);
return $form;
}