Loading composer.json +16 −5 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ "prefer-stable": true, "require": { "ext-dom": "*", "bower-asset/cropper": "^2.3", "bower-asset/slick-carousel": "^1.8", "ckeditor/fakeobjects": "4.17.1", "cweagans/composer-patches": "^1.6.0", "drupal/admin_toolbar": "^2.0", Loading @@ -21,10 +23,15 @@ "drupal/config_rewrite": "1.4", "drupal/core": "9.3.19", "drupal/core_context": "1.0-beta5", "drupal/crop": "^2.0.0-rc1", "drupal/ctools": "^3.7", "drupal/diff": "^1.0", "drupal/dropzonejs": "^2.1", "drupal/embed": "^1.0", "drupal/entity_block": "^1.0", "drupal/entity_browser": "^2.3", "drupal/entity_browser_block": "^1.0", "drupal/entity_embed": "^1.0", "drupal/entity_reference_revisions": "^1.8", "drupal/entityqueue": "^1.0-alpha8", "drupal/field_formatter": "^3.0", Loading @@ -33,14 +40,16 @@ "drupal/fontawesome": "^2.12", "drupal/footnotes": "^3.0", "drupal/group": "1.4", "drupal/image_widget_crop": "^2.1", "drupal/inline_entity_form": "^1.0-rc9", "drupal/layout_builder_restrictions": "^2.7", "drupal/layout_builder_st": "^1.0-alpha2", "drupal/layout_builder_styles": "^1.0", "drupal/layout_library": "^1.0-beta1", "drupal/lightning_core": "^5.10", "drupal/lightning_media": "^4.4", "drupal/linkit": "6.0.0-beta3", "drupal/media_entity_instagram": "^3", "drupal/media_entity_twitter": "^2.5", "drupal/media_entity_slideshow": "^2.0", "drupal/menu_block": "1.6.0", "drupal/menu_breadcrumb": "^1.13", Loading @@ -54,18 +63,24 @@ "drupal/pathauto": "1.8", "drupal/redis": "1.5", "drupal/simple_sitemap": "^3.8", "drupal/slick_entityreference": "^2.0", "drupal/toc_api": "^1.2", "drupal/toc_filter": "^2.0", "drupal/token_filter": "1.3", "drupal/url_embed": "1.0-beta1", "drupal/video_embed_field": "^2.0", "drupal/views_autocomplete_filters": "1.3", "drupal/views_bootstrap": "^3.4", "drupal/views_infinite_scroll": "^1.6", "drupal/webform": "^6.0", "drupal/webform_migrate": "1.x-dev", "drupal/wxt_bootstrap": "6.6", "drupal/wxt_library": "6.4", "drupaloverrides/lightning_layout": "2.x-dev", "drupaloverrides/lightning_media": "4.x-dev", "drupaloverrides/lightning_workflow": "3.x-dev", "npm-asset/dropzone": "^5.7.4", "vardot/blazy": "^1.8", "w8tcha/ckeditor-codemirror": "1.16" }, "require-dev": { Loading Loading @@ -277,10 +292,6 @@ "Enter drupal/lightning_core patch #3277249 description here": "https://www.drupal.org/files/issues/2022-05-08/lightning_core_remove_composer_autoload-3277249-3.patch" }, "drupal/lightning_media": { "Enter drupal/lightning_media patch #3097516 description here": "https://www.drupal.org/files/issues/2019-11-29/lightning_bulk_upload_form-3097516-2.patch" }, "drupal/linkit": { "Detect and strip base URL from pasted URLs to increase matching hits": "https://www.drupal.org/files/issues/2021-02-02/3078075-26.patch" Loading config/optional/field.storage.node.field_date_modified.yml +1 −3 Original line number Diff line number Diff line Loading @@ -4,9 +4,7 @@ dependencies: module: - datetime - node third_party_settings: field_permissions: permission_type: public third_party_settings: { } id: node.field_date_modified field_name: field_date_modified entity_type: node Loading modules/custom/wxt_core/src/DisplayHelper.php 0 → 100644 +109 −0 Original line number Diff line number Diff line <?php namespace Drupal\wxt_core; use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; /** * Helps query and configure various display settings. */ class DisplayHelper { /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * The entity field manager. * * @var \Drupal\Core\Entity\EntityFieldManagerInterface */ protected $entityFieldManager; /** * DisplayHelper constructor. * * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager. * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager * The entity field manager. */ public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager) { $this->entityTypeManager = $entity_type_manager; $this->entityFieldManager = $entity_field_manager; } /** * Returns the first available preferred view mode. * * @param string $entity_type * The entity type ID. * @param string $bundle * The bundle. * @param string[] $preferences * The view mode IDs to check, in descending order of preference. * * @return string * The first preferred view mode ID that has a view display associated with * it. If there are none, falls back to the default view mode. */ public function getPreferredMode($entity_type, $bundle, array $preferences) { $displays = $this->entityTypeManager ->getStorage('entity_view_display') ->getQuery() ->execute(); foreach ($preferences as $view_mode) { if (in_array($entity_type . '.' . $bundle . '.' . $view_mode, $displays)) { return $view_mode; } } return 'default'; } /** * Returns the components newly added to a display. * * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display * The display config entity. * * @return array * The newly added components. */ public function getNewComponents(EntityDisplayInterface $display) { if (isset($display->original)) { return array_diff_key($display->getComponents(), $display->original->getComponents()); } else { return []; } } /** * Returns newly added field components, optionally filtered by a function. * * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display * The display config entity. * @param callable $filter * (optional) The function on which to filter the fields, accepting the * field storage definition as an argument. * * @return array * The newly added components. */ public function getNewFields(EntityDisplayInterface $display, callable $filter = NULL) { $fields = $this->entityFieldManager->getFieldStorageDefinitions( $display->getTargetEntityTypeId() ); if ($filter) { $fields = array_filter($fields, $filter); } return array_intersect_key($this->getNewComponents($display), $fields); } } modules/custom/wxt_core/wxt_core.install +159 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Install and uninstall functions for the WxT installation profile. */ use Drupal\media\Entity\MediaType; use Drupal\node\Entity\NodeType; use Drupal\workflows\Entity\Workflow; Loading Loading @@ -189,7 +190,14 @@ function wxt_core_update_8410() { */ function wxt_core_update_8431() { // Remove all remnants of Lightning Workflow. $config_factory = \Drupal::configFactory(); // Create this file manually since is newly added. $config_factory->getEditable('wxt_ext_layout.settings') ->set('entity_blocks.choose_display', ['media', 'node', 'taxonomy_term', 'user']) ->save(); // Map third_party_setting lightning_workflow to wxt_ext_workflow. $entityTypeManager = \Drupal::service('entity_type.manager'); $node_types = $entityTypeManager->getStorage('node_type')->loadMultiple(); foreach ($node_types as $node_type) { Loading Loading @@ -291,3 +299,153 @@ function wxt_core_update_8431() { } } /** * Updates for the WxT 4.3.3 release. */ function wxt_core_update_8433() { $config_factory = \Drupal::configFactory(); // Create this file manually since is newly added. $config_factory->getEditable('wxt_ext_media.settings') ->set('revision_ui', false) ->set('entity_embed.choose_display', false) ->save(); // Map third_party_setting lightning_media to wxt_ext_media. $entity_form_display = $config_factory->getEditable('core.entity_form_display.media.image.media_browser'); $plugins = $entity_form_display->get('content'); foreach ($plugins as $plugin_id => $config) { if (isset($plugins[$plugin_id]['third_party_settings']['lightning_media'])) { $options = $plugins[$plugin_id]['third_party_settings']['lightning_media']; unset($plugins[$plugin_id]['third_party_settings']['lightning_media']); $plugins[$plugin_id]['third_party_settings'] = ['wxt_ext_media' => $options]; } $entity_form_display->set('content', $plugins); $entity_form_display->save(TRUE); } // Update Entity Browser dependency to wxt_ext_media. $entity_browser_config = $config_factory->getEditable('entity_browser.browser.image_browser'); $data = $entity_browser_config->getRawData(); if (isset($data['dependencies']['module']) && in_array('lightning_media', $data['dependencies']['module'])) { $key = array_search('lightning_media', $data['dependencies']['module']); $data['dependencies']['module'][$key] = 'wxt_ext_media'; $entity_browser_config->setData($data); $entity_browser_config->save(); } // Remove block_content.type.media_slideshow enforcement to lightning_media_slideshow. $block_content_config = $config_factory->getEditable('block_content.type.media_slideshow'); $data = $block_content_config->getRawData(); if (isset($data['dependencies']['enforced']['module']) && $data['dependencies']['enforced']['module'] === ['lightning_media_slideshow']) { unset($data['dependencies']['enforced']['module']); if (empty($data['dependencies']['enforced'])) { unset($data['dependencies']['enforced']); } $block_content_config->setData($data); $block_content_config->save(); } // Remove field.storage.block_content.field_slideshow_items enforcement to lightning_media_slideshow. $field_storage_config = $config_factory->getEditable('field.storage.block_content.field_slideshow_items'); $data = $field_storage_config->getRawData(); if (isset($data['dependencies']['enforced']['module']) && $data['dependencies']['enforced']['module'] === ['lightning_media_slideshow']) { unset($data['dependencies']['enforced']['module']); if (empty($data['dependencies']['enforced'])) { unset($data['dependencies']['enforced']); } $field_storage_config->setData($data); $field_storage_config->save(); } // Fully uninstall Lightning Media. /** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */ $module_installer = \Drupal::service('module_installer'); $modules_to_check = [ 'lightning_media' => (drupal_get_installed_schema_version('lightning_media') >= 0) ? TRUE : FALSE, 'lightning_media_audio' => (drupal_get_installed_schema_version('lightning_media_audio') >= 0) ? TRUE : FALSE, 'lightning_media_bulk_upload' => (drupal_get_installed_schema_version('lightning_media_bulk_upload') >= 0) ? TRUE : FALSE, 'lightning_media_document' => (drupal_get_installed_schema_version('lightning_media_document') >= 0) ? TRUE : FALSE, 'lightning_media_image' => (drupal_get_installed_schema_version('lightning_media_image') >= 0) ? TRUE : FALSE, 'lightning_media_instagram' => (drupal_get_installed_schema_version('lightning_media_instagram') >= 0) ? TRUE : FALSE, 'lightning_media_slideshow' => (drupal_get_installed_schema_version('lightning_media_slideshow') >= 0) ? TRUE : FALSE, 'lightning_media_twitter' => (drupal_get_installed_schema_version('lightning_media_twitter') >= 0) ? TRUE : FALSE, 'lightning_media_video' => (drupal_get_installed_schema_version('lightning_media_video') >= 0) ? TRUE : FALSE, ]; $needs_uninstalling = FALSE; $modules_to_uninstall = []; $uninstalled = TRUE; foreach ($modules_to_check as $module => $installed) { if ($installed) { $needs_uninstalling = TRUE; $modules_to_uninstall[] = $module; } } if ($needs_uninstalling) { $uninstalled = $module_installer->uninstall($modules_to_uninstall); $module_installer->install([ 'wxt_ext_media', 'wxt_ext_media_audio', 'wxt_ext_media_bulk_upload', 'wxt_ext_media_document', 'wxt_ext_media_image', 'wxt_ext_media_instagram', 'wxt_ext_media_slideshow', 'wxt_ext_media_twitter', 'wxt_ext_media_video', ]); } if ($needs_uninstalling && !$uninstalled) { \Drupal::configFactory() ->getEditable('core.extension') ->clear('module.lightning_media') ->clear('module.lightning_media_audio') ->clear('module.lightning_media_bulk_upload') ->clear('module.lightning_media_document') ->clear('module.lightning_media_image') ->clear('module.lightning_media_instagram') ->clear('module.lightning_media_slideshow') ->clear('module.lightning_media_twitter') ->clear('module.lightning_media_video') ->save(); \Drupal::keyValue('system.schema')->deleteMultiple([ 'lightning_media', 'lightning_media_audio', 'lightning_media_bulk_upload', 'lightning_media_document', 'lightning_media_image', 'lightning_media_instagram', 'lightning_media_slideshow', 'lightning_media_twitter', 'lightning_media_video', ]); } // Add field.storage.block_content.field_slideshow_items enforcement to wxt_ext_media_slideshow. $config_factory = \Drupal::configFactory(); $block_content_config = $config_factory->getEditable('block_content.type.media_slideshow'); $data = $block_content_config->getRawData(); $data['dependencies'] = [ 'enforced' => ['module' => ['wxt_ext_media_slideshow']], ]; $block_content_config->setData($data); $block_content_config->save(); // Add field.storage.block_content.field_slideshow_items enforcement to wxt_ext_media_slideshow. $config_factory = \Drupal::configFactory(); $block_content_config = $config_factory->getEditable('field.storage.block_content.field_slideshow_items'); $data = $block_content_config->getRawData(); $data['dependencies'] = [ 'module' => $data['dependencies']['module'], 'enforced' => ['module' => ['wxt_ext_media_slideshow']], ]; $block_content_config->setData($data); $block_content_config->save(); } modules/custom/wxt_ext/wxt_ext.info.yml +7 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,14 @@ dependencies: - 'wxt_ext_landing_page:wxt_ext_landing_page' - 'wxt_ext_layout:wxt_ext_layout' - 'wxt_ext_media:wxt_ext_media' - 'wxt_ext_media_audio:wxt_ext_media_audio' - 'wxt_ext_media_bulk_upload:wxt_ext_media_bulk_upload' - 'wxt_ext_media_document:wxt_ext_media_document' - 'wxt_ext_media_image:wxt_ext_media_image' - 'wxt_ext_media_instagram:wxt_ext_media_instagram' - 'wxt_ext_media_slideshow:wxt_ext_media_slideshow' - 'wxt_ext_media_twitter:wxt_ext_media_twitter' - 'wxt_ext_media_video:wxt_ext_media_video' - 'wxt_ext_metatag:wxt_ext_metatag' - 'wxt_ext_migration:wxt_ext_migration' - 'wxt_ext_page:wxt_ext_page' Loading Loading
composer.json +16 −5 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ "prefer-stable": true, "require": { "ext-dom": "*", "bower-asset/cropper": "^2.3", "bower-asset/slick-carousel": "^1.8", "ckeditor/fakeobjects": "4.17.1", "cweagans/composer-patches": "^1.6.0", "drupal/admin_toolbar": "^2.0", Loading @@ -21,10 +23,15 @@ "drupal/config_rewrite": "1.4", "drupal/core": "9.3.19", "drupal/core_context": "1.0-beta5", "drupal/crop": "^2.0.0-rc1", "drupal/ctools": "^3.7", "drupal/diff": "^1.0", "drupal/dropzonejs": "^2.1", "drupal/embed": "^1.0", "drupal/entity_block": "^1.0", "drupal/entity_browser": "^2.3", "drupal/entity_browser_block": "^1.0", "drupal/entity_embed": "^1.0", "drupal/entity_reference_revisions": "^1.8", "drupal/entityqueue": "^1.0-alpha8", "drupal/field_formatter": "^3.0", Loading @@ -33,14 +40,16 @@ "drupal/fontawesome": "^2.12", "drupal/footnotes": "^3.0", "drupal/group": "1.4", "drupal/image_widget_crop": "^2.1", "drupal/inline_entity_form": "^1.0-rc9", "drupal/layout_builder_restrictions": "^2.7", "drupal/layout_builder_st": "^1.0-alpha2", "drupal/layout_builder_styles": "^1.0", "drupal/layout_library": "^1.0-beta1", "drupal/lightning_core": "^5.10", "drupal/lightning_media": "^4.4", "drupal/linkit": "6.0.0-beta3", "drupal/media_entity_instagram": "^3", "drupal/media_entity_twitter": "^2.5", "drupal/media_entity_slideshow": "^2.0", "drupal/menu_block": "1.6.0", "drupal/menu_breadcrumb": "^1.13", Loading @@ -54,18 +63,24 @@ "drupal/pathauto": "1.8", "drupal/redis": "1.5", "drupal/simple_sitemap": "^3.8", "drupal/slick_entityreference": "^2.0", "drupal/toc_api": "^1.2", "drupal/toc_filter": "^2.0", "drupal/token_filter": "1.3", "drupal/url_embed": "1.0-beta1", "drupal/video_embed_field": "^2.0", "drupal/views_autocomplete_filters": "1.3", "drupal/views_bootstrap": "^3.4", "drupal/views_infinite_scroll": "^1.6", "drupal/webform": "^6.0", "drupal/webform_migrate": "1.x-dev", "drupal/wxt_bootstrap": "6.6", "drupal/wxt_library": "6.4", "drupaloverrides/lightning_layout": "2.x-dev", "drupaloverrides/lightning_media": "4.x-dev", "drupaloverrides/lightning_workflow": "3.x-dev", "npm-asset/dropzone": "^5.7.4", "vardot/blazy": "^1.8", "w8tcha/ckeditor-codemirror": "1.16" }, "require-dev": { Loading Loading @@ -277,10 +292,6 @@ "Enter drupal/lightning_core patch #3277249 description here": "https://www.drupal.org/files/issues/2022-05-08/lightning_core_remove_composer_autoload-3277249-3.patch" }, "drupal/lightning_media": { "Enter drupal/lightning_media patch #3097516 description here": "https://www.drupal.org/files/issues/2019-11-29/lightning_bulk_upload_form-3097516-2.patch" }, "drupal/linkit": { "Detect and strip base URL from pasted URLs to increase matching hits": "https://www.drupal.org/files/issues/2021-02-02/3078075-26.patch" Loading
config/optional/field.storage.node.field_date_modified.yml +1 −3 Original line number Diff line number Diff line Loading @@ -4,9 +4,7 @@ dependencies: module: - datetime - node third_party_settings: field_permissions: permission_type: public third_party_settings: { } id: node.field_date_modified field_name: field_date_modified entity_type: node Loading
modules/custom/wxt_core/src/DisplayHelper.php 0 → 100644 +109 −0 Original line number Diff line number Diff line <?php namespace Drupal\wxt_core; use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; /** * Helps query and configure various display settings. */ class DisplayHelper { /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * The entity field manager. * * @var \Drupal\Core\Entity\EntityFieldManagerInterface */ protected $entityFieldManager; /** * DisplayHelper constructor. * * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * The entity type manager. * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager * The entity field manager. */ public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager) { $this->entityTypeManager = $entity_type_manager; $this->entityFieldManager = $entity_field_manager; } /** * Returns the first available preferred view mode. * * @param string $entity_type * The entity type ID. * @param string $bundle * The bundle. * @param string[] $preferences * The view mode IDs to check, in descending order of preference. * * @return string * The first preferred view mode ID that has a view display associated with * it. If there are none, falls back to the default view mode. */ public function getPreferredMode($entity_type, $bundle, array $preferences) { $displays = $this->entityTypeManager ->getStorage('entity_view_display') ->getQuery() ->execute(); foreach ($preferences as $view_mode) { if (in_array($entity_type . '.' . $bundle . '.' . $view_mode, $displays)) { return $view_mode; } } return 'default'; } /** * Returns the components newly added to a display. * * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display * The display config entity. * * @return array * The newly added components. */ public function getNewComponents(EntityDisplayInterface $display) { if (isset($display->original)) { return array_diff_key($display->getComponents(), $display->original->getComponents()); } else { return []; } } /** * Returns newly added field components, optionally filtered by a function. * * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display * The display config entity. * @param callable $filter * (optional) The function on which to filter the fields, accepting the * field storage definition as an argument. * * @return array * The newly added components. */ public function getNewFields(EntityDisplayInterface $display, callable $filter = NULL) { $fields = $this->entityFieldManager->getFieldStorageDefinitions( $display->getTargetEntityTypeId() ); if ($filter) { $fields = array_filter($fields, $filter); } return array_intersect_key($this->getNewComponents($display), $fields); } }
modules/custom/wxt_core/wxt_core.install +159 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Install and uninstall functions for the WxT installation profile. */ use Drupal\media\Entity\MediaType; use Drupal\node\Entity\NodeType; use Drupal\workflows\Entity\Workflow; Loading Loading @@ -189,7 +190,14 @@ function wxt_core_update_8410() { */ function wxt_core_update_8431() { // Remove all remnants of Lightning Workflow. $config_factory = \Drupal::configFactory(); // Create this file manually since is newly added. $config_factory->getEditable('wxt_ext_layout.settings') ->set('entity_blocks.choose_display', ['media', 'node', 'taxonomy_term', 'user']) ->save(); // Map third_party_setting lightning_workflow to wxt_ext_workflow. $entityTypeManager = \Drupal::service('entity_type.manager'); $node_types = $entityTypeManager->getStorage('node_type')->loadMultiple(); foreach ($node_types as $node_type) { Loading Loading @@ -291,3 +299,153 @@ function wxt_core_update_8431() { } } /** * Updates for the WxT 4.3.3 release. */ function wxt_core_update_8433() { $config_factory = \Drupal::configFactory(); // Create this file manually since is newly added. $config_factory->getEditable('wxt_ext_media.settings') ->set('revision_ui', false) ->set('entity_embed.choose_display', false) ->save(); // Map third_party_setting lightning_media to wxt_ext_media. $entity_form_display = $config_factory->getEditable('core.entity_form_display.media.image.media_browser'); $plugins = $entity_form_display->get('content'); foreach ($plugins as $plugin_id => $config) { if (isset($plugins[$plugin_id]['third_party_settings']['lightning_media'])) { $options = $plugins[$plugin_id]['third_party_settings']['lightning_media']; unset($plugins[$plugin_id]['third_party_settings']['lightning_media']); $plugins[$plugin_id]['third_party_settings'] = ['wxt_ext_media' => $options]; } $entity_form_display->set('content', $plugins); $entity_form_display->save(TRUE); } // Update Entity Browser dependency to wxt_ext_media. $entity_browser_config = $config_factory->getEditable('entity_browser.browser.image_browser'); $data = $entity_browser_config->getRawData(); if (isset($data['dependencies']['module']) && in_array('lightning_media', $data['dependencies']['module'])) { $key = array_search('lightning_media', $data['dependencies']['module']); $data['dependencies']['module'][$key] = 'wxt_ext_media'; $entity_browser_config->setData($data); $entity_browser_config->save(); } // Remove block_content.type.media_slideshow enforcement to lightning_media_slideshow. $block_content_config = $config_factory->getEditable('block_content.type.media_slideshow'); $data = $block_content_config->getRawData(); if (isset($data['dependencies']['enforced']['module']) && $data['dependencies']['enforced']['module'] === ['lightning_media_slideshow']) { unset($data['dependencies']['enforced']['module']); if (empty($data['dependencies']['enforced'])) { unset($data['dependencies']['enforced']); } $block_content_config->setData($data); $block_content_config->save(); } // Remove field.storage.block_content.field_slideshow_items enforcement to lightning_media_slideshow. $field_storage_config = $config_factory->getEditable('field.storage.block_content.field_slideshow_items'); $data = $field_storage_config->getRawData(); if (isset($data['dependencies']['enforced']['module']) && $data['dependencies']['enforced']['module'] === ['lightning_media_slideshow']) { unset($data['dependencies']['enforced']['module']); if (empty($data['dependencies']['enforced'])) { unset($data['dependencies']['enforced']); } $field_storage_config->setData($data); $field_storage_config->save(); } // Fully uninstall Lightning Media. /** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */ $module_installer = \Drupal::service('module_installer'); $modules_to_check = [ 'lightning_media' => (drupal_get_installed_schema_version('lightning_media') >= 0) ? TRUE : FALSE, 'lightning_media_audio' => (drupal_get_installed_schema_version('lightning_media_audio') >= 0) ? TRUE : FALSE, 'lightning_media_bulk_upload' => (drupal_get_installed_schema_version('lightning_media_bulk_upload') >= 0) ? TRUE : FALSE, 'lightning_media_document' => (drupal_get_installed_schema_version('lightning_media_document') >= 0) ? TRUE : FALSE, 'lightning_media_image' => (drupal_get_installed_schema_version('lightning_media_image') >= 0) ? TRUE : FALSE, 'lightning_media_instagram' => (drupal_get_installed_schema_version('lightning_media_instagram') >= 0) ? TRUE : FALSE, 'lightning_media_slideshow' => (drupal_get_installed_schema_version('lightning_media_slideshow') >= 0) ? TRUE : FALSE, 'lightning_media_twitter' => (drupal_get_installed_schema_version('lightning_media_twitter') >= 0) ? TRUE : FALSE, 'lightning_media_video' => (drupal_get_installed_schema_version('lightning_media_video') >= 0) ? TRUE : FALSE, ]; $needs_uninstalling = FALSE; $modules_to_uninstall = []; $uninstalled = TRUE; foreach ($modules_to_check as $module => $installed) { if ($installed) { $needs_uninstalling = TRUE; $modules_to_uninstall[] = $module; } } if ($needs_uninstalling) { $uninstalled = $module_installer->uninstall($modules_to_uninstall); $module_installer->install([ 'wxt_ext_media', 'wxt_ext_media_audio', 'wxt_ext_media_bulk_upload', 'wxt_ext_media_document', 'wxt_ext_media_image', 'wxt_ext_media_instagram', 'wxt_ext_media_slideshow', 'wxt_ext_media_twitter', 'wxt_ext_media_video', ]); } if ($needs_uninstalling && !$uninstalled) { \Drupal::configFactory() ->getEditable('core.extension') ->clear('module.lightning_media') ->clear('module.lightning_media_audio') ->clear('module.lightning_media_bulk_upload') ->clear('module.lightning_media_document') ->clear('module.lightning_media_image') ->clear('module.lightning_media_instagram') ->clear('module.lightning_media_slideshow') ->clear('module.lightning_media_twitter') ->clear('module.lightning_media_video') ->save(); \Drupal::keyValue('system.schema')->deleteMultiple([ 'lightning_media', 'lightning_media_audio', 'lightning_media_bulk_upload', 'lightning_media_document', 'lightning_media_image', 'lightning_media_instagram', 'lightning_media_slideshow', 'lightning_media_twitter', 'lightning_media_video', ]); } // Add field.storage.block_content.field_slideshow_items enforcement to wxt_ext_media_slideshow. $config_factory = \Drupal::configFactory(); $block_content_config = $config_factory->getEditable('block_content.type.media_slideshow'); $data = $block_content_config->getRawData(); $data['dependencies'] = [ 'enforced' => ['module' => ['wxt_ext_media_slideshow']], ]; $block_content_config->setData($data); $block_content_config->save(); // Add field.storage.block_content.field_slideshow_items enforcement to wxt_ext_media_slideshow. $config_factory = \Drupal::configFactory(); $block_content_config = $config_factory->getEditable('field.storage.block_content.field_slideshow_items'); $data = $block_content_config->getRawData(); $data['dependencies'] = [ 'module' => $data['dependencies']['module'], 'enforced' => ['module' => ['wxt_ext_media_slideshow']], ]; $block_content_config->setData($data); $block_content_config->save(); }
modules/custom/wxt_ext/wxt_ext.info.yml +7 −0 Original line number Diff line number Diff line Loading @@ -18,7 +18,14 @@ dependencies: - 'wxt_ext_landing_page:wxt_ext_landing_page' - 'wxt_ext_layout:wxt_ext_layout' - 'wxt_ext_media:wxt_ext_media' - 'wxt_ext_media_audio:wxt_ext_media_audio' - 'wxt_ext_media_bulk_upload:wxt_ext_media_bulk_upload' - 'wxt_ext_media_document:wxt_ext_media_document' - 'wxt_ext_media_image:wxt_ext_media_image' - 'wxt_ext_media_instagram:wxt_ext_media_instagram' - 'wxt_ext_media_slideshow:wxt_ext_media_slideshow' - 'wxt_ext_media_twitter:wxt_ext_media_twitter' - 'wxt_ext_media_video:wxt_ext_media_video' - 'wxt_ext_metatag:wxt_ext_metatag' - 'wxt_ext_migration:wxt_ext_migration' - 'wxt_ext_page:wxt_ext_page' Loading