You are here

function _insert_media_get_view_modes in Insert 8.2

Returns all media view modes.

Return value

\Drupal\Core\Entity\EntityViewModeInterface[]

3 calls to _insert_media_get_view_modes()
insert_media_field_widget_settings_summary_alter in modules/insert_media/insert_media.module
Implements hook_field_widget_settings_summary_alter().
_insert_media_settings in modules/insert_media/insert_media.module
_insert_media_settings_form in modules/insert_media/insert_media.module

File

modules/insert_media/insert_media.module, line 197

Code

function _insert_media_get_view_modes() {
  $viewModes = \Drupal::entityTypeManager()
    ->getStorage('entity_view_mode')
    ->loadByProperties([
    'targetEntityType' => 'media',
  ]);
  $rekeyedViewModes = [];
  foreach ($viewModes as $id => $viewMode) {

    // Settings cannot be saved with a dot.
    $rekeyedViewModes[str_replace('media.', '', $id)] = $viewMode;
  }
  return $rekeyedViewModes;
}