function media_field_widget_settings_form in D7 Media 7
Same name and namespace in other branches
- 7.4 includes/media.fields.inc \media_field_widget_settings_form()
- 7.2 includes/media.fields.inc \media_field_widget_settings_form()
- 7.3 includes/media.fields.inc \media_field_widget_settings_form()
Implement hook_field_widget_settings_form().
File
- includes/
media.fields.inc, line 213 - : Provides a "Multimedia asset" field to the fields API
Code
function media_field_widget_settings_form($field, $instance) {
$widget = $instance['widget'];
$settings = $widget['settings'];
$form = array();
// Setup type selection form
$types = media_type_get_types();
$options = array();
foreach ($types as $key => $definition) {
$options[$key] = $definition->label;
}
$streams = file_get_stream_wrappers(STREAM_WRAPPERS_VISIBLE);
$form['allowed_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed remote media types'),
'#options' => $options,
'#default_value' => $settings['allowed_types'],
'#description' => t('Media types which are allowed for this field when using remote streams.'),
'#weight' => 1,
'#access' => count(file_get_stream_wrappers(STREAM_WRAPPERS_VISIBLE | STREAM_WRAPPERS_LOCAL)) != count($streams),
);
$options = array();
foreach ($streams as $scheme => $data) {
$options[$scheme] = t('@scheme (@name)', array(
'@scheme' => $scheme . '://',
'@name' => $data['name'],
));
}
$form['allowed_schemes'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed URI schemes'),
'#options' => $options,
'#default_value' => $settings['allowed_schemes'],
'#description' => t('URI schemes include public:// and private:// which are the Drupal files directories, and may also refer to remote sites.'),
'#weight' => 2,
);
return $form;
}