- π¦π·Argentina drupal-son
Hi @nginx and folks, any update on this?
Is this a bug or a feature request to support entity (media in this case) embeds on WYSIWYG when exporting?Thanks for this great module.
- πΊπ¦Ukraine nginex
Hi @drupal-son,
Thanks for the feedback, this issue looks like a feature request, I was not thinking of having a possibility to support embed entities in WYSIWYG when created the module, in any case this is a great idea and I already have a few ideas how to provide support for this.
I think I can develop this feature later this week and provide a new release e.g. 1.4
- π¦π·Argentina drupal-son
That sounds great!
SCS module is really really useful, I'm using it to replacing a full database clone from environments (which I hate), but as soon as my user finds a use case when it doesn't export a specific field, he push back to database cloning method again.
I envision this module could be part of Core not too late.
The Entity Embed into WYSIWYG solution is widely used in multiple websites, so the module must support it In order to be part of it.I would like to contribute somehow, I reviewed the documentation page https://www.drupal.org/docs/contributed-modules/single-content-sync/expo... β for trying to understand the underlying data structure, but because the exports run on a batch, it is not easy to debug.
Can you point me with better real examples on how to extend the module to support a custom fields or not-yet-supported contributed fields?The fix for my other feature request https://www.drupal.org/project/single_content_sync/issues/3332663 π Avoid importing entity into another website Fixed worked amazingly, even more features that I imagined. Thank you for that.
- πΊπ¦Ukraine nginex
What a nice feedback!
If you wish to contribute a solution for this issue you can looks how layout_section field type is exported and do similar for text_long
https://git.drupalcode.org/project/single_content_sync/-/blob/1.3.x/src/...
1. Collect media entities from WYSIWYG text value and export them sepratly into a dedicated property as it's done for blocks in the example.
Btw you can do the same with contributation by using hook_content_export_field_value().
2. See implementation of MediaEmbed::process() to see how to getch media entities from the text.
3. Import entities for the text_long similar to layout_section, but much simpler https://git.drupalcode.org/project/single_content_sync/-/blob/1.3.x/src/...
- @nginex opened merge request.
- Status changed to Needs review
over 1 year ago 4:05pm 20 March 2023 - πΊπ¦Ukraine nginex
Hey @drupal-son, I added the fix to the issue, you can test it by applying a patch from MR, if it's working for you change status to RTBC.
It was easier that I thought ;)
- π¦π·Argentina drupal-son
OMG, you are faster than me :)
Let me test the patch and I'll let you know in a bit.Thanks.
- π¦π·Argentina drupal-son
@nginex Sorry for the delay, not so easy to test as I need 2 environments with the patch applied.
The YML file looks good, I compared it before and after the patch, and now it seems to have the embedded entity with all its attributes.
However, the image itself on the assets folder wasn't generated.
When imported, the media entity was created but with a broken default image.Does it make sense?
- πΊπ¦Ukraine nginex
I tested on Umami Food Magazine profile Drupal 9.5 and I used Download as a zip with all assets and it worked without issues. Did you test with other fields that are referencing to media if they are exporting with generated assets?
- π¦π·Argentina drupal-son
The content type has other referenced media entities fields, for those cases, the images were exported without issues.
Another thing to mention, my long_text contains more than 1 media embed (3 of them to be more exact), also more than 1 long_text field too with multiple
media embeds.
The yml contains the 3 uuid but the images are not into the assets folder.Iβm not at the desk right now, I need to check the content type structure, but it might be possible that this is a multi value paragraph that contains some fields and the long text with media embeds into it.
- π¦π·Argentina drupal-son
@nginex I can confirm that my content type has some paragraph multivalue fields, where the paragraph contains the long text WYSIWYG field, where multiple media images are embedded. These images are not exported into the zip package.
Just for clarifying, at the same time, the content type has media fields. These images are exported fine into the zip package.
- πΊπ¦Ukraine nginex
@drupal-son thanks for reporting, I have enough information to reproduce the issue
- π¦π·Argentina drupal-son
Were you able to reproduce the issue?
Do you think it is useful to share my yml file so you can see the generated structure?
- πΊπ¦Ukraine nginex
@drupal-son, it would be nice if you could share your yml file.
I'm going to test it today with similar structure
- π¦π·Argentina drupal-son
@nginex this might sound weird but I was able to make the patch work, not sure why it didn't work the last time.
I think this is RTBM.BTW, I was also able to export a custom field using the export/import hooks. It worked like a charm.
- Status changed to RTBC
over 1 year ago 4:51pm 23 March 2023 - πΊπ¦Ukraine HitchShock Ukraine
Tested the solution on the two existing project + on the empty project.
Steps:
* installed module single_content_sync
* installed this patch
* prepared the test content
** added media image to the formatted text field
** added media file to the formatted text field
** added paragraph with formatted text field
** added media image to the formatted text field of the paragraph
** added media file to the formatted text field of the paragraph
* exported the entity with all assets
* removed test content
* removed related media entities
* removed related files
* imported data on the same site and checked the result - OK
* imported data on the other site but with the same structure - OKThe fix worked as expected.
- 3379f4f0 committed on 1.3.x
Issue #3346367: Add support of embed entities from CKEditor
- 3379f4f0 committed on 1.3.x
- Status changed to Fixed
over 1 year ago 6:24pm 23 March 2023 - Status changed to Fixed
over 1 year ago 6:42pm 23 March 2023