Active
Project:
Paragraphs Defaults
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Feb 2016 at 10:34 UTC
Updated:
19 Nov 2017 at 21:38 UTC
Jump to comment: Most recent
Comments
Comment #2
cornelyus commentedInstalled the module, everything working fine.. until I wanted to export in features the defaults of one of the paragraphs field. Because couldn't find nothing in the features to do so, just reached the issue list and found this thread.. Did a couple of tests with the suggestion above about system_settings_form and it seems to me that in order to work would have to change substancial stuff in the module.
So in the end, I'm not using the module, just "hard-coded" what I needed for now on a specific paragraph field of a form as default. Because I got it to work, maybe I can input something, and throw a couple of questions in here.
1. Is it really necessary to save in an independed table the defaults?
2. Why the need to create the defaults also as paragraphs items, and then do a "replicate" in the form_alter?
Becuase what I found it works, instead of the replicate is to instantiate a
.
With this I believe saving the a variable that with an array of field_name, bundle and the defaults would suffice, while also being exportable. Hope this makes sense..
Comment #3
rv0 commentedSaving as variables in Drupal does not scale well.
As defaults are entities, and entities are content in Drupal 7, there's isn't a pretty way to put them in features (perhaps some contrib module allows this?).
I'm afraid this will be a "won't fix" issue, unless someone can convince me otherwise with a patch or technical advice.
Comment #4
cornelyus commentedBut, do the defaults really need to be entities? Or just the info of what entitites to create?
Comment #5
rv0 commentedthis was actually my initial approach when I wrote this module, but I luckily switch to using the paragraph entities pretty quick (and it made things a lot simpler)
keep in mind an entity can contain any field, and there's lots of contrib field module out there, it would probably not be easy to universally support them all with the approach you suggest.
have a look at uuid_features:
https://www.drupal.org/project/uuid_features
I think that would be part of a solution..
Comment #6
cornelyus commentedThanks for the explanation @rv0 , you're probably right.. I was being reductive on my view because my use case is simpler than a broader solution. I just need paragraphs created with default values.. not create a default paragraph with "whatever is inside".
Comment #7
firewaller commentedThis may be overkill, but since you can't save the module's defaults in features, I created an install function that can be added to a custom module in case anybody is compelled to manually export their defaults: