function media_library_field_ui_preconfigured_options_alter
Same name in other branches
- 9 core/modules/media_library/media_library.module \media_library_field_ui_preconfigured_options_alter()
- 8.9.x core/modules/media_library/media_library.module \media_library_field_ui_preconfigured_options_alter()
- 11.x core/modules/media_library/media_library.module \media_library_field_ui_preconfigured_options_alter()
Implements hook_field_ui_preconfigured_options_alter().
File
-
core/
modules/ media_library/ media_library.module, line 345
Code
function media_library_field_ui_preconfigured_options_alter(array &$options, $field_type) {
// If the field is not an "entity_reference"-based field, bail out.
$class = \Drupal::service('plugin.manager.field.field_type')->getPluginClass($field_type);
if (!is_a($class, EntityReferenceItem::class, TRUE)) {
return;
}
// Set the default field widget for media to be the Media library.
if (!empty($options['media'])) {
$options['media']['entity_form_display']['type'] = 'media_library_widget';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.