Problem/Motivation
If I have a new node type with Canvas Override enabled:
dependencies:
module:
- canvas_override
- menu_ui
third_party_settings:
menu_ui:
available_menus:
- main
parent: 'main:'
canvas_override:
enabled: true
Then I run drush cim on this type, it fails:
The import failed due to the following reasons:
Unexpected error during import with operation create for node.type.MY_CONTENT_TYPE: Missing bundle entity, entity type node_type, entity id MY_CONTENT_TYPE.
Unexpected error during import with operation create for field.field.node.MY_CONTENT_TYPE.field_canvas_layout: Missing bundle entity, entity type node_type, entity id MY_CONTENT_TYPE.
This is because CanvasOverride::nodeTypePresave() fires unconditionally and tries to create the Canvas field on the content type before the content type exists.
Steps to reproduce
- Create a new content type
- Enable Canvas Override
ddev drush cex -y- Delete the content type
ddev drush cim -y
Proposed resolution
Remaining tasks
- ✅ File an issue
- ✅ Addition/Change/Update/Fix
- ✅ Testing to ensure no regression
- ✅ Automated unit testing coverage
- ✅ Automated functional testing coverage
- ➖ UX/UI designer responsibilities
- ➖ Readability
- ➖ Accessibility
- ➖ Performance
- ➖ Security
- ➖ Developer Documentation
- ➖ User Guide Documentation
- ➖ Reviewed by human
- ➖ Code review by maintainers
- ➖ Full testing and approval
- ✅ Credit contributors
- ➖ Review with the product owner
- ➖ Release notes snippet
- ✅ Release
User interface changes
- N/A
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- N/A
Issue fork canvas_override-3616302
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
longwaveProposed fix that works for me; move the presave hook to insert/update hooks, and explicitly skip when we are syncing config (we assume that the config import is correct and dependencies will be handled for us).
Comment #8
rajab natshah✅ Released canvas_override-1.0.0-beta3
Comment #9
rajab natshahComment #10
rajab natshahComment #12
rajab natshah