Problem/Motivation
I have a sub profile project of wxt. When I do a site install I get a message about missing config media.type.image. It is coming from the hook install (stacj trace below). I looked for the config and can find it in several places (optional in lightning_media), it isn't in wxt_ext_media. I tried in optional in wxt_ext_media and that didn't work. However, if I add it to install it seems to be ok. Not sure if this is a valid solution.
Steps to reproduce
- create a subprofile of wxt
- have a dependency on wxt_ext_media
- do a site install
In EntityType.php line 877:
[LogicException]
Missing bundle entity, entity type media_type, entity id image.
Exception trace:
at /var/www/html/core/lib/Drupal/Core/Entity/EntityType.php:877
Drupal\Core\Entity\EntityType->getBundleConfigDependency() at /var/www/html/core/modules/language/src/Entity/ContentLanguageSettings.php:208
Drupal\language\Entity\ContentLanguageSettings->calculateDependencies() at /var/www/html/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:318
Drupal\Core\Config\Entity\ConfigEntityBase->preSave() at /var/www/html/core/modules/language/src/Entity/ContentLanguageSettings.php:167
Drupal\language\Entity\ContentLanguageSettings->preSave() at /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php:494
Drupal\Core\Entity\EntityStorageBase->doPreSave() at /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php:449
Drupal\Core\Entity\EntityStorageBase->save() at /var/www/html/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:263
Drupal\Core\Config\Entity\ConfigEntityStorage->save() at /var/www/html/core/lib/Drupal/Core/Entity/EntityBase.php:339
Drupal\Core\Entity\EntityBase->save() at /var/www/html/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:591
Drupal\Core\Config\Entity\ConfigEntityBase->save() at /var/www/html/core/modules/content_translation/src/ContentTranslationManager.php:85
Drupal\content_translation\ContentTranslationManager->setEnabled() at /var/www/html/profiles/wxt/modules/custom/wxt_translation/wxt_translation.module:29
wxt_translation_enable_translation() at /var/www/html/profiles/wxt/modules/custom/wxt_ext/wxt_ext_media/wxt_ext_media.install:18
wxt_ext_media_install() at n/a:n/a
call_user_func_array() at /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php:392
Drupal\Core\Extension\ModuleHandler->invoke() at /var/www/html/core/lib/Drupal/Core/Extension/ModuleInstaller.php:325
Drupal\Core\Extension\ModuleInstaller->install() at /var/www/html/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install() at /var/www/html/core/includes/install.core.inc:1880
_install_module_batch() at /var/www/html/core/includes/batch.inc:295
_batch_process() at /var/www/html/core/includes/form.inc:950
batch_process() at /var/www/html/core/includes/install.core.inc:650
install_run_task() at /var/www/html/core/includes/install.core.inc:568
install_run_tasks() at /var/www/html/core/includes/install.core.inc:118
install_drupal() at /var/www/vendor/drush/drush/includes/drush.inc:213
drush_call_user_func_array() at /var/www/vendor/drush/drush/includes/drush.inc:197
drush_op() at /var/www/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php:149
Drush\Commands\core\SiteInstallCommands->install() at n/a:n/a
call_user_func_array() at /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
Consolidation\AnnotatedCommand\CommandProcessor->process() at /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:311
Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /var/www/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/vendor/symfony/console/Application.php:1027
Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:118
Drush\Runtime\Runtime->doRun() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:49
Drush\Runtime\Runtime->run() at /var/www/vendor/drush/drush/drush.php:72
require() at /var/www/vendor/drush/drush/drush:4
Proposed resolution
Add the media.type.image config from lightning into the install config of wxt_wxt_media
Remaining tasks
review?
User interface changes
none
API changes
none
Data model changes
none
Comment | File | Size | Author |
---|---|---|---|
#2 | 3188088-2.patch | 537 bytes | natew |
Comments
Comment #2
natew CreditAttribution: natew as a volunteer commentedComment #3
sylus CreditAttribution: sylus commentedLet me check this out,
wxt_ext_media has a dependency on lightning_media_image which itself has the media.type.image.yml under config/optional.
So this shouldn't need to be done.
Comment #4
sylus CreditAttribution: sylus commentedOkay I finally understand this, the problem is a long standing one with Drupal core it just really seems you can't do everything in the same batch as dependency resolution has some issues. We actually solved this in the 4.0.x line which is why people don't seem to be having and dep problems any more.
Lets take a look at the following:
Particularly take note of these lines:
What we do and other distributions like Lightning, DeGov, and Open Social is we let the install profile install just very simple core modules as a base, and then finish the installation of the profile, themes, and core set of modules.
Then we create another batch step that installs the rest of the modules once the base install is done, this both fixes long standing dependency issues and in general follows actually what a person would do once they install Drupal and then install modules afterwards. This both aligns with that workflow, fixes dependency issues, and allows for us to make the remaining modules optional.
The problem with your subprofile is that you are trying to do things too early in the bootstrap and instead should do your config and module enablement in the wxt_extension_configure_form step once the base of the site and core is fully installed.
So here is what I would like you to try to proof this works!
STEP 1
Note I removed the install of CCEI core below:
STEP 2
Add the following file `ccei_core.wxt_extension.yml` to CCEI Core below:
Now I think you can just pass "wxt_extension_configure_form.select_all=TRUE" so all optional modules are enabled or just set the default: true for the above file and only this module should be enabled. It will be important though if any of your modules require any wxt_ext_* dependencies that you declare that explicit dependency.
For a temporary hammer approach you could set ccei_core to have a dependency on wxt_ext itself set the default to true in the above file and then see if everything is working before you go more granular in your deps. You wouldn't need the drush flag since you set default to true.
Basically we want you to have all of your custom stuff in our next batch step technically after Drupal is installed, and this will resolve a whole host of problems arounds dep and very close to people just enabling modules etc post install in the GUI :D
I hope this makes sense :D
Comment #5
sylus CreditAttribution: sylus commentedComment #6
natew CreditAttribution: natew as a volunteer commentedThanks Will for looking at this and helping, going to close this as your solution worked in the latest 4.x-dev!
Comment #7
sylus CreditAttribution: sylus commentedComment #8
sylus CreditAttribution: sylus commented