You are here

final class Update240 in Lightning Media 8.3

Same name in this branch
  1. 8.3 src/Update/Update240.php \Drupal\lightning_media\Update\Update240
  2. 8.3 modules/lightning_media_video/src/Update/Update240.php \Drupal\lightning_media_video\Update\Update240
Same name and namespace in other branches
  1. 8.4 modules/lightning_media_video/src/Update/Update240.php \Drupal\lightning_media_video\Update\Update240
  2. 8.2 modules/lightning_media_video/src/Update/Update240.php \Drupal\lightning_media_video\Update\Update240

Contains optional updates targeting Lightning Media Video 2.4.0.

Plugin annotation

@Update("2.4.0");

Hierarchy

  • class \Drupal\lightning_media_video\Update\Update240

Expanded class hierarchy of Update240

File

modules/lightning_media_video/src/Update/Update240.php, line 12

Namespace

Drupal\lightning_media_video\Update
View source
final class Update240 {

  /**
   * Installs a media type for locally hosted video files.
   *
   * @update
   *
   * @ask Do you want to install the "Video file" media type?
   */
  public function installVideoFileMedia() {
    $helper = ConfigHelper::forModule('lightning_media_video');
    $helper
      ->getEntity('media_type', 'video_file')
      ->save();
    $helper
      ->getEntity('field_storage_config', 'media.field_media_video_file')
      ->save();
    $helper
      ->getEntity('field_config', 'media.video_file.field_media_video_file')
      ->save();
    $helper
      ->getEntity('field_config', 'media.video_file.field_media_in_library')
      ->save();
    $helper
      ->getEntity('entity_form_display', 'media.video_file.media_browser')
      ->save();
    $helper
      ->getEntity('entity_view_display', 'media.video_file.embedded')
      ->save();
    $helper
      ->getEntity('entity_view_display', 'media.video_file.thumbnail')
      ->save();

    // Handle entity displays as simple config, since they are created
    // automatically when the media type is imported.
    $helper
      ->get('core.entity_form_display.media.video_file.default')
      ->save(TRUE);
    $helper
      ->get('core.entity_view_display.media.video_file.default')
      ->save(TRUE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Update240::installVideoFileMedia public function Installs a media type for locally hosted video files.