function asset_field_settings in Asset 5.2
Same name and namespace in other branches
- 5 modules/asset_content.inc \asset_field_settings()
- 6 modules/asset_content.inc \asset_field_settings()
- 6 inc/modules/asset_content.inc \asset_field_settings()
Implementation of hook_field_settings().
File
- modules/
asset_content.inc, line 15
Code
function asset_field_settings($op, $field) {
switch ($op) {
case 'form':
$type_options = array();
$types = asset_get_types();
foreach ($types as $key => $type) {
$type_options[$key] = $type->name;
}
$form['allowed_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed asset types'),
'#description' => t('Limit the selectable assets to only assets of the selected type(s).'),
'#options' => $type_options,
'#default_value' => $field['allowed_types'],
);
$form['allowed_extensions'] = array(
'#type' => 'textfield',
'#title' => t('Allowed file extensions'),
'#description' => t('Filter the available file type assets by this comma separated list of file extensions. This only applies to File assets. Ex: jpg,gif,png'),
'#default_value' => $field['allowed_extensions'],
);
$options = array();
$formatters = asset_get_formatters();
foreach ($formatters as $key => $formatter) {
$options[$key] = $formatter->name;
}
$form['valid_formatters'] = array(
'#type' => 'select',
'#title' => t('Valid formatters'),
'#description' => t('Limit the selectable assets to only assets that support these formatters. Leave empty to allow all assets.'),
'#options' => $options,
'#multiple' => TRUE,
'#size' => min(count($options), 10),
'#default_value' => $field['valid_formatters'],
);
return $form;
case 'save':
return array(
'allowed_types',
'allowed_extensions',
'valid_formatters',
);
case 'database columns':
return array(
'aid' => array(
'type' => 'int',
'length' => '10',
'not null' => TRUE,
'default' => 0,
),
);
case 'filters':
return array();
break;
}
}