backdrop-contrib / paragraphs

Paragraphs module to control your content flow
https://backdropcms.org/project/paragraphs
GNU General Public License v2.0
5 stars 11 forks source link

paragraph bundle not exported/imported #28

Closed robertgarrigos closed 4 years ago

robertgarrigos commented 5 years ago

I created a new paragraph bundle in a dev site, added a new field to it, checked that it was working and then exported the new configurations with drush bcex. Commited and pushed changes to my git repository and pulled from my staging site. Then imported the new configurations with drush bcim to the staging site and pargraph bundle was missing. Checked back again that config files were present, cleared cache a few times, but paragraph bundle was sill missing.

Finally, I just created manually the paragraph bundle with the same machine name and voilà! it appeared again with its field. Wondering why...

laryn commented 5 years ago

@robertgarrigos Interesting! Any ideas? @serundeputy can I drag you into this one for input?

serundeputy commented 5 years ago

I'd create a paragraph bundle on a dev site and import the config via Backdrop UI (sans drush) and see if the config takes.

laryn commented 5 years ago

Thanks @serundeputy!

@robertgarrigos can you try the above and let me know the result?

robertgarrigos commented 5 years ago

Right, I'm having different issues with config import/export. I have two "gited" blank local sites (with lando, backdrop1 and backdrop2), with paragraph enabled on both (default profile), create one bundle (in backdrop1 only) and add it a bundle field (text). Then:

drush

drush export config and git push on backdrop1, git pull and drush import on backdrop2. Results: the bundle paragraph is not created. BUT: you can create a bundle with the same name and you get the bundle WITH the bundle text field listed in it. HOWEVER: it's a ghost field. It shows as created in the bundle but when you go to delete it, you get an error about a missing table for that bundle field. Thus, the bundle field is listed but not created.

web

export config on backdrop1 with web form and import it on backdrop2 with web form. The bundle doesn't get created and if you create it again with the same name, as before, the bundle field doesn't show listed, nor it is created either.

serundeputy commented 5 years ago

Seems a but with paragraphs not exporting all the field definitions to config; needs a field config and field instance at least i think.

Have not looked at this code, but seems like the bug is a paragraphs bug.

mazzech commented 4 years ago

I can confirm that... still no paragraph bundles in export. Just compared a export of "body field" with export "paragraphs body field" (created separately), there is no mention of an Entity Type. Screenshot 2019-11-17 at 12 36 03

laryn commented 4 years ago

@serundeputy If you have a second to gander at these lines -- is this our problem on this issue? https://github.com/backdrop-contrib/paragraphs/blob/1.x-1.x/ParagraphsItemEntity.inc#L491-L506

robertgarrigos commented 4 years ago

@laryn I don't think this export() method is ever called. There is not such a method in entity.class (its parent).

robertgarrigos commented 4 years ago

I believe this bug is triggered due to the lack of any hookconfig* functions in paragraphs. Am I right??

robertgarrigos commented 4 years ago

I think this would be fixed by implementing the hook_config_create function (maybe also the update one) which should trigger paragraphs_save_bundle() function, as the only thing missing in the backdrop install is the entry of the bundle in the paragraphs_bundle table in ddbb.

laryn commented 4 years ago

@robertgarrigos Could this also be related to the fact that Paragraph bundles/types haven't (yet) been converted to CMI in the same way that content types were in core? https://github.com/backdrop-contrib/paragraphs/issues/46

Your concept sounds worth testing -- but I won't have time to create a PR in the near future. If you are able sooner I will definitely test.

robertgarrigos commented 4 years ago

Once this PR (https://github.com/backdrop-contrib/paragraphs/pull/66) is merged I will fix this issue, as it does much more sense to have paragraphs bundles as CMI before.

laryn commented 4 years ago

@robertgarrigos I've merged your bundles -> CMI PR. Thanks for that! Happy to also review any PRs here if/when you get to it.

ghost commented 4 years ago

I experienced this problem where a Paragraphs bundle wasn't appearing on a new site after importing config. After reading the above, I updated to the latest dev version of this module which has the CMI patch. That allowed the Paragraphs bundle to get exported from the old site, which wasn't happeneing previously.

Then, when I tried importing it to the new site, I got an error about no module owning that file. Some research turned up the need for modules to implement hook_config_info(), so I did that for Paragraphs and it worked. Paragraphs bundle was imported and works nicely.

@laryn Here's a PR: https://github.com/backdrop-contrib/paragraphs/pull/68

laryn commented 4 years ago

Thanks @BWPanda -- one minor comment in the PR.

ghost commented 4 years ago

@laryn Cool, PR updated.

laryn commented 4 years ago

Thanks @BWPanda !