TransWikia.com

Cannot import Paragraph based Feature into new site

Drupal Answers Asked on November 25, 2021

Perhaps someone with a bit more Features expertise can help me here.

I have a Drupal site with 25 or so Paragraph types that I would like to export (one by one) to its own contained Feature.

I installed the latest version of Features, and created a new bundle called Paragraphs. In this new bundle, I enabled Paragraphs as a Base Type so they are an exportable option.

I go back to the main Features admin, and click “Create new feature”. I fill out the basic info here, the name of the feature, then I select the Paragraph Type I want to export and wait for all of the required dependencies to auto populate. I finish the export by clicking on “Write” which produces the module folder.

In the new Drupal site I want to import it to, I see it in the list of Features. When I go to enable the module, I get an error like:

Error importing field.field.paragraph.text_editor.field_rich_text :
Attempt to create a field field_rich_text that does not exist on
entity type paragraph.

Except… this Feature should be introducing this field into the application and install it. The Paragraph just has a long text field for CKEditor, and there is no field.storage.paragraph.field_rich_text.yml file that is exported. Yet, field.storage.paragraph.field_rich_text is listed as a config dependency in the same said Feature.

Did I miss a step here? I basically want to export my Paragraph types as if they were Node types. I want to install them into a new Drupal installation without wiring them to any reference fields or Node types – I want to do that later.

Why am I getting errors like Attempt to create a field field_rich_text that does not exist on entity type paragraph.? I get a similar error for each Paragraph I try to enable, which are all made up of basic fields and nothing special.

Note: it looks like the auto detection doesn’t quite work. For example, if I pick one of the Paragraphs from the list of non-exported Features on the overview page, the field storage definitions that are marked as a dependency in the output are NOT selected for being exported here.

I started over and removed all the exported Features, and created a new Feature. This time, when I picked the paragraph type, it still did not include the field storage definition for the field that is being bundled. When I selected it, exported it, this time it enabled on the new site, no error.

What is the proper way to do this? Do I have to go through one by one and simply ensure the field storage(s) are exported myself?

One Answer

My best answer to this question is: Features is awesome but a little buggy, or seemingly so, due to field and field storage dependencies. The best solution I have found in Drupal using features and all these export issues is to create a content type where you create ALL your field base instances. I always call mine xxxFields. Then in all other content types, always add an "existing" field. really all this is doing is helping with user error. I have used features from 7 and now into 8, and I find that most issues arise through configuration of numerous content types which share fields, which creates dependency issues when trying to export features modules.

I believe your specific issue may be that that module is trying to create itself but has a dependency for a field base and field storage configuration that was created in another content type.

Answered by Preston on November 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP