You are here

function _insert_media_settings in Insert 8.2

Parameters

\Drupal\Core\Field\WidgetInterface $plugin:

Return value

array

3 calls to _insert_media_settings()
insert_media_field_widget_form_alter in modules/insert_media/insert_media.module
Implements hook_field_widget_form_alter().
insert_media_field_widget_settings_summary_alter in modules/insert_media/insert_media.module
Implements hook_field_widget_settings_summary_alter().
insert_media_field_widget_third_party_settings_form in modules/insert_media/insert_media.module
Implements hook_field_widget_third_party_settings_form().

File

modules/insert_media/insert_media.module, line 43

Code

function _insert_media_settings($plugin) {
  $settings = array_merge(INSERT_MEDIA_DEFAULT_SETTINGS, $plugin
    ->getThirdPartySettings('insert_media'));
  if (!empty($settings['view_modes']['<all>'])) {
    $viewModeIds = array_keys(_insert_media_get_view_modes());
    $settings['view_modes'] = array_fill_keys($viewModeIds, $viewModeIds);
  }

  // Ensure default view mode is in the set of view modes.
  if (!in_array($settings['default'], $settings['view_modes'], TRUE)) {
    $settings['view_modes'][$settings['default']] = $settings['default'];
  }
  return $settings;
}