Problem/Motivation

To facilitate keeping the distribution lightweight and because soon the Lightning Contrib modules will be EOL we need to remove Lightning Media in a way that doesn't break an upgrade path and documents the modules removed in case site builders will want to manually add them to their composer.json file

On a default WxT installation the following components are enabled.

 Lightning Media (lightning_media)
 Lightning Media Audio (lightning_media_audio) 
 Lightning Bulk Media Upload (lightning_media_bulk_upload)
 Lightning Media Document (lightning_media_document)
 Lightning Media Image (lightning_media_image) Enabled
 Lightning Media Instagram (lightning_media_instagram)
 Lightning Media Slideshow (lightning_media_slideshow)
 Lightning Media Twitter (lightning_media_twitter)

Lighting Media module itself has the following module dependencies though it has all the various sub modules listed above

 - drupal:ckeditor
 - entity_browser:entity_browser
 - drupal:image
 - inline_entity_form:inline_entity_form
 - lightning_core:lightning_core
 - drupal:media_library
 - drupal:user

Lightning Media composer.json has the following module dependencies.

"bower-asset/cropper": "^2.3",
"bower-asset/slick-carousel": "^1.8",
"drupal/crop": "^2.0.0-rc1",
"drupal/dropzonejs": "^2.1",
"drupal/embed": "^1.0",
"drupal/entity_browser": "^2.3",
"drupal/entity_embed": "^1.0",
"drupal/image_widget_crop": "^2.1",
"drupal/inline_entity_form": "^1.0-rc7",
"drupal/media_entity_instagram": "^3",
"drupal/media_entity_twitter": "^2.5",
"drupal/slick_entityreference": "^2.0",
"drupal/video_embed_field": "^2.0",
"drupal/views_infinite_scroll": "^1.6",
"npm-asset/dropzone": "^5.7.4",
"vardot/blazy": "^1.8"

Therefore the following composer entries are the ones that have been removed from the distribution now.

Nothing removed at the moment

Steps to reproduce

N/A

Proposed resolution

Uninstall the Lightning Media module while maintaining an upgrade path.

To accomplish this all of the lightning_media modules and sub modules will be ported to wxt_ext_media counterparts.

Configuration Objects were also checked pre / post update to ensure the delta is as expected.

* third_party_settings for lightning_media now become wxt_ext_media
* configuration objects are now fully owned in config/optional with less use of config/rewrite
* lightning_media.settings has been mapped to wxt_media.settings as well as
* some configuration enforcements that once used lightning_media now use wxt_ext_media
* etc

Then over the next few releases we can slowly start to remove further functionality inherited from Lightning that is now better handled via Core and / or not used anymore.

Remaining tasks

N/A

User interface changes

Lightning Media will no longer be presented in the admin menu.

API changes

N/A

Data model changes

Largely wxt_ext_media and all of the wxt_ext_media_* submodules which most already exist now take over the configuration objects provided by lightning_media and lightning_media_*. The existing config_rewrites for the configuration objects have been updated and moved over to the base configuration under config/install and / or config/optional.

Comments

sylus created an issue. See original summary.

joseph.olstad’s picture

So to upgrade with the least disturbance we'll probably want to composer require all of these right?

        "bower-asset/cropper": "^2.3",
        "bower-asset/slick-carousel": "^1.8",
        "drupal/crop": "^2.0.0-rc1",
        "drupal/dropzonejs": "^2.1",
        "drupal/embed": "^1.0",
        "drupal/entity_browser": "^2.3",
        "drupal/entity_embed": "^1.0",
        "drupal/image_widget_crop": "^2.1",
        "drupal/inline_entity_form": "^1.0-rc7",
        "drupal/media_entity_instagram": "^3",
        "drupal/media_entity_twitter": "^2.5",
        "drupal/slick_entityreference": "^2.0",
        "drupal/video_embed_field": "^2.0",
        "drupal/views_infinite_scroll": "^1.6",
        "npm-asset/dropzone": "^5.7.4",
        "vardot/blazy": "^1.8"

?

or will these be added to wxt composer.json?

sylus’s picture

At joseph.olstad yup I am adding to the root composer.json just trying to see if i can remove everything but no changes for end users. :)

sylus’s picture

Issue summary: View changes
sylus’s picture

Issue summary: View changes
sylus’s picture

Issue summary: View changes
sylus’s picture

Issue summary: View changes
sylus’s picture

Issue summary: View changes
sylus’s picture

Status: Active » Needs review

  • sylus committed bc94808 on 4.3.x
    Issue #3301875: [Deprecate] Remove Lightning Media
    
sylus’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

joseph.olstad’s picture

after the upgrade to 4.3.4 I've still got post-upgrade freshly exported configuration that says it's dependant on lightning_media. Some custom modules uninstalled automatically due to having dependencies on lightning_media. Wondering why the exported configurations would still say dependant on media, ah yes, install of wxt_ext_media failed for me

I got this error trying to install wxt_ext_media which I bypassed with a patch otherwise was stuck:
[error] Configuration objects (core.entity_view_mode.media.embedded, core.entity_view_mode.media.thumbnail, field.storage.media.embed_code, field.storage.media.field_media_in_library) provided by wxt_ext_media already exist in active configuration

#3316384: wxt3 to wxt4.3.4 upgrade issue

joseph.olstad’s picture

I believe there's a programmable way to force these to be overwritten manually. Something like this:


hook_install() {
  $module_handler = \Drupal::moduleHandler();

  $config_path = $module_handler->getModule('module_name')->getPath() . '/config/install';
  $source = new FileStorage($config_path);

  $configurations = [
    'core.entity_view_mode.media.embedded',
    'core.entity_view_mode.media.thumbnail',
    'field.storage.media.embed_code',
    'field.storage.media.field_media_in_library',
  ];

  foreach ($configurations as $config_name) {
    $config_record = $source->read($config_name);
    $config = \Drupal::service('config.factory')->getEditable($config_name);

    // The condition here is not really useful, but is here for posterity.
    // The next DEV who needs to separate the two could use this as a base.
    // Create new config.
    if ($config->isNew()) {
      if (is_array($config_record)) {
        $config->setData($config_record)->save();
      }
    }
    else {
      // Update existing config.
      if (is_array($config_record)) {
        $config->setData($config_record)->save();
      }
    }
  }
}

upgrade path past 4.3.0+ is broken, can't manually fix these there's hundreds of sites to upgrade.

joseph.olstad’s picture