Commit 33bd9208 authored by xjm's avatar xjm

Issue #3051826 by tim.plunkett, mikemadison: 8.7.0-rc1 database updates fail...

Issue #3051826 by tim.plunkett, mikemadison: 8.7.0-rc1 database updates fail on media_library configuration dependencies due to missing form and view modes
parent 9b1690c2
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Post update functions for Media library. * Post update functions for Media library.
*/ */
use Drupal\Core\Entity\Entity\EntityFormMode;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\media\Entity\MediaType; use Drupal\media\Entity\MediaType;
use Drupal\views\Views; use Drupal\views\Views;
...@@ -12,6 +14,29 @@ ...@@ -12,6 +14,29 @@
* Create and configure Media Library form and view displays for media types. * Create and configure Media Library form and view displays for media types.
*/ */
function media_library_post_update_display_modes() { function media_library_post_update_display_modes() {
// Ensure the custom view and form modes are created.
$values = [
'id' => 'media.media_library',
'targetEntityType' => 'media',
'label' => t('Media library'),
'dependencies' => [
'enforced' => [
'module' => [
'media_library',
],
],
'module' => [
'media',
],
],
];
if (!EntityViewMode::load('media.media_library')) {
EntityViewMode::create($values)->save();
}
if (!EntityFormMode::load('media.media_library')) {
EntityFormMode::create($values)->save();
}
// The Media Library needs a special form display and view display to make // The Media Library needs a special form display and view display to make
// sure the Media Library is displayed properly. These were not automatically // sure the Media Library is displayed properly. These were not automatically
// created for custom media types, so let's make sure this is fixed. // created for custom media types, so let's make sure this is fixed.
......
...@@ -47,16 +47,6 @@ ...@@ -47,16 +47,6 @@
'name', 'name',
'data', 'data',
]) ])
->values([
'collection' => '',
'name' => 'core.entity_form_mode.media.media_library',
'data' => 'a:9:{s:4:"uuid";s:36:"a95ff3d3-19ca-4a20-9ed5-63574ffaf4fa";s:8:"langcode";s:2:"en";s:6:"status";b:1;s:12:"dependencies";a:2:{s:8:"enforced";a:1:{s:6:"module";a:1:{i:0;s:13:"media_library";}}s:6:"module";a:1:{i:0;s:5:"media";}}s:5:"_core";a:1:{s:19:"default_config_hash";s:43:"pkq0uj-IoqEQRBOP_ddUDV0ZJ-dKQ_fLcppsEDF2UO8";}s:2:"id";s:19:"media.media_library";s:5:"label";s:13:"Media library";s:16:"targetEntityType";s:5:"media";s:5:"cache";b:1;}',
])
->values([
'collection' => '',
'name' => 'core.entity_view_mode.media.media_library',
'data' => 'a:9:{s:4:"uuid";s:36:"aa86ec5c-3c36-44c5-b5b5-ade8bba3f549";s:8:"langcode";s:2:"en";s:6:"status";b:1;s:12:"dependencies";a:2:{s:8:"enforced";a:1:{s:6:"module";a:1:{i:0;s:13:"media_library";}}s:6:"module";a:1:{i:0;s:5:"media";}}s:5:"_core";a:1:{s:19:"default_config_hash";s:43:"pkq0uj-IoqEQRBOP_ddUDV0ZJ-dKQ_fLcppsEDF2UO8";}s:2:"id";s:19:"media.media_library";s:5:"label";s:13:"Media library";s:16:"targetEntityType";s:5:"media";s:5:"cache";b:1;}',
])
->values(array( ->values(array(
'collection' => '', 'collection' => '',
'name' => 'views.view.media_library', 'name' => 'views.view.media_library',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment