Problem/Motivation
Being able to download content as zip can be useful for multiple purposes:
- Reviewing all the content of the site, out of browsing the site
- Analyzing texts with AI
- Generating content with AI using content first as part of the prompt.
Proposed resolution
Create a custom Drupal action to generate a ZIP. Study if there is no issues generating the zip as the final step.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | Content First Error.png | 331.19 KB | sandeep_k |
| #10 | After Patch.png | 386.54 KB | sandeep_k |
| #9 | after.mp4 | 1.68 MB | kul.pratap |
Issue fork content_first-3536846
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 #2
omarlopesinoThe plan is developing it the next week and releasing it at beta7.
Comment #3
omarlopesinobeta8
Comment #4
kul.pratap commentedWorking on it.
Comment #5
omarlopesinoOh it was on my plans doing this but I haven't started yet, so contributions are welcome :)
If you are going to work on it, I expect that this feature works technically as follows:
- Do a Drupal Action Plugin to save the markdown generated by content_first.builder service into a temporary file.
- Allow this action to be enabled at /admin/content, so any content needing downloading can be selected.
- After doing the bulk operations, save all the files into a ZIP.
- Either display a Drupal message linking the generated file, or auto download it in the next page load.
This would be a "Drupal way" solution that would meet the requirement, otherwise it can become tricky I think.
Comment #6
kul.pratap commentedYes, I am on it and doing it the same way as you mentioned.
@omarlopesino We want both HTML and Markdown, or just Markdown, in the downloaded ZIP.
Comment #7
omarlopesinoIf it is easy, we could add a selector in the action plugin configuration form to choose between HTML or Markdown. My only concern is I don't remember if that configuration is global for all the selected elements, or is specific for each one. If it is global, go for it. Otherwise, only markdown.
Comment #9
kul.pratap commented@omarlopesino I have created an action that downloads a ZIP file. For now, I have only created action for markdown.
For reference, I am attaching a video on how it works.
Please review.
Thanks
Comment #10
sandeep_k commented@kul.pratap I tried this MR !3 mergeable on Drupal version- 10.3.1-dev, the patch was applied successfully, but I am not getting that option to download the zip as shown in the video.
Also, while I was trying to access the node- Content first tab, it's throwing an error.
Please check and let me know if I have missed any steps here.
Comment #11
kul.pratap commented@sandeep_k you have not installed the "league/html-to-markdown": "^5.1" this is a package which is require to run this module.
You can see in the composer.json
After that reinstall the module.
Comment #12
omarlopesinoIt works perfect, thanks also for correcting most of styling errors reported by drupalci!
I've done some slight adjustments and I am merging it.
Thanks!
Comment #14
omarlopesinoReleased at beta9
Comment #15
omarlopesino