You are here

function media_field_widget_settings_form in D7 Media 7.3

Same name and namespace in other branches
  1. 7.4 includes/media.fields.inc \media_field_widget_settings_form()
  2. 7 includes/media.fields.inc \media_field_widget_settings_form()
  3. 7.2 includes/media.fields.inc \media_field_widget_settings_form()

Implements hook_field_widget_settings_form().

File

includes/media.fields.inc, line 36
Provide media selector widget and media field formatters to the fields API.

Code

function media_field_widget_settings_form($field, $instance) {
  $widget = $instance['widget'];
  $settings = $widget['settings'];
  $plugins = media_get_browser_plugin_info();
  $options = array();
  foreach ($plugins as $key => $plugin) {
    $options[$key] = check_plain($plugin['title']);
  }
  $form['browser_plugins'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Enabled browser plugins'),
    '#options' => $options,
    '#default_value' => $settings['browser_plugins'],
    '#description' => t('Media browser plugins which are allowed for this field. If no plugins are selected, they will all be available.'),
  );
  $form['allowed_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Allowed file types'),
    '#options' => file_entity_type_get_names(),
    '#default_value' => $settings['allowed_types'],
    '#description' => t('File types which are allowed for this field. If no file types are selected, they will all be available.'),
  );
  $visible_steam_wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_VISIBLE);
  $options = array();
  foreach ($visible_steam_wrappers as $scheme => $information) {
    $options[$scheme] = check_plain($information['name']);
  }
  $form['allowed_schemes'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Allowed URI schemes'),
    '#options' => $options,
    '#default_value' => $settings['allowed_schemes'],
    '#description' => t('URI schemes which are allowed for this field. If no schemes are selected, they will all be available.'),
  );
  return $form;
}