Preparing your Drupal 8.3 site with Media for Drupal 8.4

If you have the Media module for Drupal 8 installed (not a requirement to use media with Drupal 8, so this post may not apply to you), you need to remove it before you can upgrade to the latest core version (8.4). Unfortunately, there are a few gotchas involved with the process. This blog post is about getting rid of the old contrib Media module, so the site can be updated to Drupal 8.4 in a subsequent step. This is based on my personal experience. YMMV, as they say.

Originally I published this post on december 25th of 2017. Merry Christmas! Since this blog was added to Planet Drupal yesterday, I thought it would benefit others to re-date this to today, so it would appear in the Planet feed.

Having to maintain this site in my spare time, it has been far too long for me to upgrade it to Drupal 8.4 (it actually went live on Drupal 8.3 when 8.4 was already final, because the platform had been running for a while for another site and frankly, I just wanted it live—something about a plumber and leaky pipes). The site had been built with the contrib Media module, which turns out to be a bit of a mistake (just because of the problems I outline below, not because there was anything wrong with the module), but that's water under the bridge.

Where the Media module for Drupal 7 is the core for a (the?) leading Media solution, for Drupal 8 that responsibility moved to the new media_entity module, as well as a bunch of extension modules that add specific media types. In short, Media in Drupal 8 is much more modular. The Media module itself still existed, but it was basically a quick start suite of configuration and a few tweaks to how things worked out of the box.

The reason removing the contrib Media module is needed is that from 8.4 on, media_entity was integrated into core, except that is is now called... Media module. This means the contrib Media module would have a name collision with the new Media module in core. So, it needs to be disabled. Which is mostly OK (you can retain most of the configuration it adds), except for a new nasty gotchas.

Note that this is not about moving your site to the core media entity type. That is something that will have to happen eventually. You will have to wait for all extension modules (image, video, maybe gallery, Twitter or Instagram, etc.) to have versions that work with the core entity type, as well as for the upgrade path to be complete. This needs to happen, though, if you currently have Media module and you need to move to Drupal 8.4 (and you do need to; 8.3 stopped being supported when 8.4 came out).

Gotcha #1: Route "view.media.media_page_list" does not exist

When I first tried disabling the contrib Media module (which I will simply call Media module for the remainder of this blog post), I was greeted by this lovely error message. In full, it read:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "view.media.media_page_list" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 190 of core/lib/Drupal/Core/Routing/RouteProvider.php).

It went along with the dreaded "An unexpected error occurred" as well as a giant stack trace, but that's just due to my development environment settings.

The View is what the Media module added in place of the View that's also added by media_entity module. I haven't quite figured out how this situation came to be, but there is still a View in the exported configuration, presumably the one added by media_entity. However, as far as I can tell, there were no actual changes to the exported configuration, so it is still a bit puzzling. Luckily, the solution turned out to be fairly straightforward; the View had its status key set to false in the exported configuration yml-file (views.view.media.yml):

langcode: nl
status: false
dependencies:
  config:
    - core.entity_view_mode.media.media_library
    - media_entity.bundle.gallery
  module:
    - entity_browser
    - media_entity
    - user

Changing it to true and re-importing configuration got rid of this problem (don't forget to remove media in core.extension.yml if you do this; chances are you didn't get a chance to actually export the configuration after disabling the Media module, so re-importing your exported configuration would happily re-enable it again—in fact, you could skip the step of disabling the module through the interface and simply remove its line from core.extension.yml).

Gotcha #2: Media module contains some tweaks

The Media module contains some useful tidbits (mostly tweaks to standard core or contrib functionality). If you are getting ready to update a site to the next minor core version, you are not in the state of mind to deal with functional regressions and/or changes (especially to find out how to turn regressions into changes). At least, I wasn't. That's why I created the Media Glue sandbox module, that basically just contains the css, javascript and hook implementations that Media did, except under a different name space so it does not collide with the new core Media module. It does contain one little change, which involves the styling for the entity browser. The Media module contained a small bug that caused the items to jump around in the browser when hovering over them (at least in my browser of choice, Safari). The css for the new module has been tweaked so the elements are the same size for both regular and hover states.

I will probably want to figure out how I want to get rid of this module at some point, as I usually prefer to stay closer to base functionality as opposed to install all sorts of little modules that may add small niceties; extra modules can break and also add a slight performance penalty. There also apparently are various modules that do something similar, which would appear to be better starting points. But that's stuff for another blog post.

Gotcha #3: When you decide you don't need Media entity slideshow

As said, Media module came with a bunch of configuration. It added all that configuration as install configuration (not optional), so it had dependencies on extension modules that were required for all that configuration. As I previously mentioned, I'm no great fan of stuff I don't really need; all it can do is break. So I figured I could remove some of the extras that came with Media. Mostly, this is no problem. You can disable the Document, Instagram and Twitter modules if you don't need them. Any configuration dependent on them, like media entity bundles and display settings, will be removed. (The same likely goes for the video embed module, but I haven't tried).

However, when you elect to remove the Media Entity Slideshow module, Drupal will make an odd report about configuration that will be removed; in addition to the usual suspects (the media bundle and all its derived configuration like fields and displays) it will want to remove the Media Embed and Media Library entity browsers as well as the Media library View. The last one is the key here. The other two depend on it, because they use it as their browser view. The View itself contains two displays that are used for the Entity Browser that is meant for creating galleries (which, oddly, does not get removed, in my experience). These displays contain a filter option to exclude galleries (in order to avoid gallery inception). Thus, the View depends on its existence and if we wish to remove the bundle, we need to remove the View. 

At this point, the safest option is to abort the uninstalling of the module and go and edit the troublesome View. You need to remove the two displays:

  1. Gallery media select modal
  2. Gallery User Media select modal

Save the View and export the configuration.

Unfortunately, this did not remove the actual dependency from the View, only the displays that are the reason for having the dependency. Open the views.view.media_libary.yml file in your editor and look for all values containing gallery. This will turn up everything that had to do with the media bundle. Remove the lines you find. Save the file and re-import configuration. 

Go and uninstall the module again. If the View and entity browsers are still being listed, try and clear the cache. Finally, remove the gallery_media_library entity browser (admin/config/content/entity_browser).

After the module is uninstalled, do another config export.

Next steps

That's basically it. At this point, you will have to release your changes through your DTAP street (if that doesn't mean anything to you, don't worry; it simply means you have to get these changes into production) to prepare your site for the actual move to Drupal 8.4. You can not remove the Media module before getting it disabled (if you have a clever release process, you might be able to do removals at the very end, which would allow you to do things in one go).

If you use a composer-based build process, you will need to remove drupal/media from your composer.json. At the same time, you will need to add back any modules that were previously dependencies of Media that you wish to keep. The full list of dependencies for (from its .info.yml file) Media looks like this:

dependencies:
  - media_entity:media_entity
  - media_entity_image:media_entity_image
  - video_embed_field:video_embed_field
  - video_embed_field:video_embed_media
  - media_entity_slideshow:media_entity_slideshow
  - media_entity_instagram:media_entity_instagram
  - media_entity_twitter:media_entity_twitter
  - media_entity_document:media_entity_document
  - slick_media:slick_media
  - entity_browser:entity_browser
  - entity_browser:entity_browser_entity_form
  - entity_embed:entity_embed
  - dropzonejs:dropzonejs_eb_widget
  - image_widget_crop:image_widget_crop
  - drupal:link
  - drupal:editor
  - inline_entity_form:inline_entity_form
test_dependencies:
  - media_entity:media_entity
  - media_entity_image:media_entity_image
  - video_embed_field:video_embed_field
  - video_embed_field:video_embed_media
  - media_entity_slideshow:media_entity_slideshow
  - media_entity_instagram:media_entity_instagram
  - media_entity_twitter:media_entity_twitter
  - media_entity_document:media_entity_document
  - slick_media:slick_media
  - entity_browser:entity_browser
  - entity_browser:entity_browser_entity_form
  - entity_embed:entity_embed
  - dropzonejs:dropzonejs_eb_widget
  - image_widget_crop:image_widget_crop
  - drupal:link
  - drupal:editor
  - inline_entity_form:inline_entity_form

Find out the versions you have installed currently and require them explicitly in your composer.json. If you added everything you need to keep, you can go ahead and remove media itself. Rebuild the site and make sure everything still works. You are now ready to actually take the step and update to Drupal 8.4.

Comments

You don't have to update to core media in 8.4

I have several production sites that updated to 8.4, but kept running media_entity from contrib.

Choosing to switch to core media is something you can do when the time is appropriate, and certainly shouldn't hold up moving to 8.4

Yes, and so this does blog. The post is not about moving from media_entity to core media, but about getting rid of the Media moduleif you have it installed. Which is a big if, because you can have a perfectly working system without it based on media_entity.

If you have suggestions on how I can make that more clear, please let me know.

Edit: I added a little bit to the intro to hopefully make this clearer without overstating it.

how much Eulexin in UK/GB delivery NO PRESCRIPTION ; cheapest Eulexin in Australia c.o.d. NO RX

http://trustedmeds.store/shop/go.php?sid=5&search=Eulexin - >>> Want to buy with Discount? CLICK HERE! <<<

GO to PHARMACY >>> http://bit.ly/us-meds

Cost in Australia Of Eulexin cash on delivery overnight = http://thehubhospitality.com/forum/welcome-mat/214039-discount-prices-c…
Where To Buy Eulexin without rx,next day delivery @ http://www.aileetour.com/index.php/forum/welcome-mat/30616-where-to-buy…
Low Prices Eulexin no prior script overnight = http://forumjudi.asia/showthread.php?tid=266727&pid=638397#pid638397
Online Eulexin no prescription c.o.d. >> http://petisikedaulatan.org/forums/topic/what-is-mesothelioma-law-firm-…
Online in Canada Eulexin no prescription overnight \\ http://soldatko.jrgp.us/index.php?topic=205892.new#new
Buying in Australia At Lowest Price Eulexin c.o.d. no script - http://www.meneghello.com/index.php/forum/welcome-mat/136934-discount-p…
Purchase Cheapest Eulexin no prescription // http://barcovaldeorras.grupotecopy.es/index.php/en/component/kunena/2-b…
How To Purchase Eulexin c.o.d. no script * http://www.tonybrooksarchitects.net/index.php/forum/welcome-mat/26158-o…
Low Prices Generic Eulexin shipped with no prescription @ http://www.nsbbms.in/index.php/en/forum/welcome-mat/88824-buy-online-ch…
Purchase in USA At Low Price Eulexin overnight without a prescription )) http://drawings.wpblog.jp/forums/topic/low-cost-vardenafil-with-dapoxet…
Buy Cheap Eulexin saturday delivery )) http://fdp-wilnsdorf.de/forum.php?newt=1&topic_id=1010752
Best Place To Buy Eulexin no script needed > http://www.pescamag.it/component/kunena/legacy-platforms/70621-brand-or…
Order in Canada cheapest Eulexin no prescription no fees \\ http://labobiondar.com/index.php/forum/welcome-mat/15906-fast-delivery-…
Online in Australia Eulexin without dr prescription // http://xn---111-u4dsaihhxb6c.xn--p1ai/index.php/forum/razdel-predlozhen…
How Much in Australia Eulexin next day delivery << http://demo.7910.org/forum/showthread.php?tid=8/newreply.php?tid=28042%…
Best Place in Canada To Buy Eulexin next day no prescription needed / http://myrtlefordsoccer.com.au/forum/welcome-mat/167223-order-online-at…
Where Can I Buy Eulexin no prior prescription > http://www.tornadobattery.com/index.php/forum/welcome-mat/7766-order-on…
Buying in USA At Lowest Price Eulexin no script next day delivery - http://www.flab3d.com/forum-tag-view-id-9253-time-1524065178.html
Purchase Cheap Online in USA Eulexin fast shipping no prescription \\ http://quedensgaard.dk/index.php/forum/welcome-mat/311825-order-at-low-…
Pharmacies in GB / UK That Sell Eulexin without doctor prescription // http://www.icsacummins.cl/index.php/forum/welcome-mat/19716-order-onlin…
Online in Canada Eulexin in internet,next day delivery > http://www.chinapearlcity.net/content/13983
Cost in USA Of Eulexin same day delivery no prescription ! http://gencyemleri.com/forum/welcome-mat/50583-lowest-price-cialis-ligh…
Best Place in Canada To Buy Eulexin without a prescription shipped overnight # http://thehubhospitality.com/forum/welcome-mat/213894-where-can-i-buy-o…
Order in USA Online Cheap Eulexin no prescription )) http://cychacks.com/index.php?topic=318734.new#new
Ordering in Canada Online Eulexin no prescription no fees ??? http://www.schodysluka.cz/forum/welcome-mat/7606-order-at-low-price-rab…
USA Licensed Pharmacy Eulexin in internet,next day delivery = http://sozvesdie.su/news/pomogite-u-moejj-mamy-rak-podzheludochnojj-zhe…
How Much in GB / UK Eulexin no prescription needed = http://www.louisraaijmakers.nl/forum/welcome-mat/53627-quality-generic-…
Where To Order in GB / UK Famciclovir no script required / http://www.unimd.org/bbs/home.php?mod=space&uid=733
How To Purchase Eulexin overnight delivery no r x - http://www.wafidun.com/forums/%D8%B9%D9%85%D8%A7%D9%84%D8%A9-%D9%85%D9%…
Generic Drugs Betamethasone / Clotrimazole no rx, fast worldwide shipping // http://axongaming.com/forums/topic/new-article-about-cars/page/7/#post-…
Where Can I Order in Canada Eulexin free prescription drug \\ http://demo.7910.org/forum/showthread.php?tid=8/newreply.php?tid=28042%…
Cost in Canada Of Eulexin no prescription // http://www.bekmar.co.za/index.php/forum/welcome-mat/62-online-maxaquin-…
Purchase in Canada At Low Price Eulexin without doctor prescription = http://www.eae-et.com.tr/kabinplus/index.php/forum/certifications/10612…
Cheap Price Of Eulexin c.o.d. no script # http://gencyemleri.com/forum/welcome-mat/50567-how-to-order-ed-medium-p…
Cost in USA Of Eulexin shipped overnight without a prescription )) http://reclutameahora.com/index.php/forum/3-releases-and-updates/67301-…
Buy in Canada At Low Price Eulexin delivered overnight no rx @ http://www.e-market.com.co/index.php/forum/welcome-mat/45132-low-cost-a…
How Can I Buy in Canada Eulexin online ??? http://www.canadiandiscussion.com/index.php/topic,273125.new.html#new
Where Can I Order in GB / UK Eulexin overnight without dr approval ! http://www.nokia6303.cz/
Cost in USA Of Eulexin no prior script overnight ! http://www.toneeldegoorn.nl/gastenboek/
Buying in USA Generic Eulexin with no prescription ??? http://support.dagopert.at/index.php/forum/welcome/318552-i-want-to-buy…
Where To Order Eulexin cheap c.o.d. no rx > http://www.ntf.org.na/index.php/kunena/welcome-mat/5733-order-at-low-pr…
Cheapest Prices in Australia for Eulexin in without prescription @ http://www.ilmarhit.it/component/kunena/
Buy Cheapest Eulexin pharmacy no prescription << http://krahsr.com/bbs/thread-236270-post-1053287.html#pid1053287
Purchase Cheap Online in Australia Eulexin from u.s. pharmacy no prescription // http://barcovaldeorras.grupotecopy.es/index.php/en/component/kunena/
Where Can I Purchase in Canada Eulexin tablet without script // https://whobba.fr/newreply.php?tid=18066&load_all_quotes=1
Order in Australia Cheap Generic Repaglinide with credit card no prescription = http://zusluze.cz/kniha-navstev/?from=30&select=4
Low Cost Eulexin c.o.d. without rx \ http://minegenics.com/index.php/forum/welcome-mat/87578-fda-approved-ya…
Buying in Canada Eulexin with no prescription - http://www.averagegeek.me/index.php/forum/welcome-maw/395342-wholesale-…
Ordering in Australia Online Eulexin c.o.d. without rx \\ http://zhotel.gr/el/forum/welcome-mat/76991-buy-at-low-price-viagra-pay…

buying at lowest price Retin-A Gel in UK with NO PRESCRIPTION ; order cheap Retin-A Gel in UK NO PRESCRIPTION no fees

[url=http://trustedmeds.store/shop/go.php?sid=5&search=Retin-A Gel] [u][b]>>> Want to buy with Discount? CLICK HERE! <<<[/b][/u] [/url]

GO to PHARMACY >>> https://tr.im/americanpills

Buy in USA Cheapest Retin-A Gel no dr approval cash on delivery )) http://shaivitetemple.org/Forum/topic/where-can-i-buy-stendrafree-deliv…
Australian Licensed Pharmacy Retin-A Gel next day delivery / http://powtalk.org/index.php?topic=105605.new#new
GB / UK Licensed Pharmacy Retin-A Gel next day delivery << http://www.oldfartriders.com/oldfarts2/newreply.php?do=newreply&p=30249…
Fda Approved Retin-A Gel without prescription >> http://www.videsprojekti.lv/vnews/22941.html
Where Can I Purchase Retin-A Gel no prescription no fees ??? http://www.orcasys.co/index.php/forum/general-questions/379024-best-pri…
Cheap Price Of Retin-A Gel cash on delivery online prescriptions > http://factorio-forums.ashenglowgaming.com/viewtopic.php?f=3&t=251463
How To Buy Retin-A Gel no dr approval cash on delivery = http://crossfaernet.tk/index/8-32708
Australia Online Pharmacy Retin-A Gel next day delivery no rx \ http://www.lifespringministries.org/index.php/forum/welcome-mat/17674-o…
Buy in GB / UK At Low Price Retin-A Gel without a rx overnight )) http://www.geocontrol.cl/index.php/forum/welcome-mat/67133-order-cheap-…
Cheapest Price To Order Retin-A Gel next day no prescription )) http://bbs.infinixmobility.com/home.php?mod=space&uid=2381717
Order in Australia cheapest Retin-A Gel pharmacy without a prescription )) http://www.widowsandwidowers.co.uk/forum/welcome-mat/2634-buy-online-ch…
Fast Delivery Retin-A Gel overnight delivery no r x ??? http://barcovaldeorras.grupotecopy.es/index.php/en/component/kunena/2-b…
Canadian Licensed Pharmacy Retin-A Gel non prescription needed > http://www.haciendaspaloverde.com/en/component/kunena/2-welcome-mat/362…
Purchase in USA At Low Price Retin-A Gel no prescription // http://turkmodifiye.club/newreply.php?tid=86300&replyto=122022
How Much in GB / UK Retin-A Gel without script >> http://debarrastattu.com/index.php/forum/welcome-mat/6318-cheap-online-…
Purchase in United States cheapest Retin-A Gel free prescription drug - http://www.lifespringministries.org/index.php/forum/welcome-mat/17637-q…
Buy in Australia cheapest Retin-A Gel no prescription next day delivery // http://kursyjezykoweonline.pl/forum/welcome-mat/100733-cheap-capecitabi…
Cheapest Retin-A Gel overnight without dr approval - http://www.abcfiles.cz/komentare/125624-opravy-a-servis-notebooku-pc-a-…
Order in UK cheapest Retin-A Gel no prescription overnight \ http://barcovaldeorras.grupotecopy.es/index.php/en/component/kunena/2-b…
Order in GB / UK Cheap Generic Retin-A Gel in no prescription = http://amazon-kindle.by/catalog/ebook/amazon-kindle-keyboard-3-wifi.htm…
Canada Online Pharmacy Retin-A Gel next day delivery // http://www.prestacom-pa.com.br/index.php/kforum/welcome-mat/584008-chea…
Buy in USA Cheap Online Retin-A Gel c.o.d. no script / http://www.gotofinland.ru/discussion.html?discussion=1&page=11
Buying in USA At Lowest Price Retin-A Gel non prescription > http://kkusiusk.com/index.php/component/kunena/2-welcome-mat/261265-buy…
How To Buy in USA Retin-A Gel for sale online * http://parlatube.com/index.php/forum/welcome-mat/671-order-online-at-lo…
Order in Australia Online Cheap Retin-A Gel shipped overnight without a prescription // http://napoliproverbitradizioni.altervista.org/portale/?q=node/825
Purchase in Australia Cheapest Retin-A Gel without a prescription ??? http://www.tornadobattery.com/index.php/forum/welcome-mat/2141-ordering…
Buy in GB / UK At Low Price Retin-A Gel c.o.d. without prescription * http://menaraengineers.com/forum/welcome-mat/
Ordering in GB / UK Online Perindopril next day delivery @ http://www.schodysluka.cz/forum/welcome-mat/7582-buy-online-cheapest-za…
Buying in Australia Retin-A Gel no prescription needed = http://bacolodcars.com/forum/index.php/topic,185804.new.html#new
GB / UK Licensed Pharmacy Retin-A Cream without a rx overnight - http://gencyemleri.com/forum/welcome-mat/50581-price-of-ivermectin-ship…
Where To Order in Canada Retin-A Gel no prescription fast delivery \\ http://akvareli-balashiha.ru/inwidget/index.php?toolbar=false&inline=2
Buying in Australia At Lowest Price Retin-A Gel overnight without dr approval > http://www.trainingtrust.org/forum/welcome-mat/24539-order-at-low-price…
Buy in Canada Discount Retin-A Gel pay cod without prescription \ http://propet.sk/poradna/posts/t7/p1136865#p1136865
Low Prices Retin-A Gel c.o.d. no rx # http://www.allshoreplumbing.com/index.php/forum/welcome-mat/25941-lowes…
Where To Order in USA Retin-A Gel overnight without a prescription / http://www.portematik.pl/a/2242?page=
Order At Low Cost in USA Retin-A Gel saturday delivery - http://www.louisraaijmakers.nl/forum/welcome-mat/53569-order-at-low-pri…
How Much in Australia Retin-A Gel no script needed - http://3comltd.com/index.php/component/kunena/2-welcome-mat/263110-safe…
Ordering in USA Online Retin-A Gel no prescription fedex / ups > http://www.schodysluka.cz/forum/welcome-mat/7584-buy-safety-ribavirin-f…
Purchase At Low Cost in GB / UK Retin-A Gel no prescription overnight - http://gymmuelle.co/index.php/forum/welcome-mat/194153-where-to-get-bim…
Price Of Retin-A Gel fast shipping no prescription > http://menaraengineers.com/index.php/forum
Order Cheap Generic Retin-A Gel non prescription needed = http://linen.campuslaundry.org/index.php/forum/welcome-mat/11356-low-pr…
How To Order in GB / UK Retin-A Gel no prescription )) http://www.bekmar.co.za/index.php/forum/welcome-mat/224447-wholesale-ch…
Online in Australia Retin-A Gel next day delivery ??? http://irenehomes.co.za/forum/welcome-mat/23445-licensed-pharmacy-zithr…
Purchase in Canada Cheapest Retin-A Gel without script pharmacy / http://woodleighhillside.com/index.php?topic=490968.new#new
Buying in GB / UK Retin-A Gel overnight no prescription = http://zusluze.cz/kniha-navstev/?from=30&select=4
Pharmacies in Australia That Sell Sumatriptan fast shipping no prescription >> http://3comltd.com/index.php/component/kunena/2-welcome-mat/263105-lowe…
Where Can I Order Retin-A Gel without a prescription shipped overnight >> http://strizhki.ru/forum/ob-yavleniya/67076-purchase-at-lowest-price-tr…
Buying in USA At Lowest Price Retin-A Gel from a pharmacy without a prescription = http://www.radiostudio92.it/2015/kunena/benvenuto/595-sporanox-itracona…
Pharmacies That Sell Retin-A Gel without rx,next day delivery * http://www.grandchase.asia/board/topic/368945-where-can-i-buy-rivastigm…

Add new comment