Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Just found this module and I'm excited about how much time it could save. I'm wondering if there's a way this module could provide synchronization of instances across bundles. I haven't worked out the specifics, but essentially I want a master list of fields and updating one instance updates all instances. I understand this is the opposite of what instances are for, but it can be really painful to update many instances, eg to change the maximum image dimensions, or available insert presets.
Comment | File | Size | Author |
---|---|---|---|
#30 | 2032735-30.field_tools.edit-display.patch | 14.9 KB | joachim |
#22 | display-settings-across-bundles-2032735-22.patch | 14.03 KB | rudins |
#19 | display-settings-across-bundles-2032735-19.patch | 14.01 KB | rudins |
#15 | display-settings-across-bundles-2032735-15.patch | 11.55 KB | rudins |
#11 | display-settings-across-bundles-2032735-9.patch | 13.78 KB | killua99 |
Comments
Comment #1
killua99 CreditAttribution: killua99 commentedI love this idea.
Writing on it cause I'm looking for something like this.
Comment #2
joachim CreditAttribution: joachim commentedYou can already do this if you go to admin/reports/fields/tools
Does this need to be added to the docs so it's easier to find?
Comment #3
killua99 CreditAttribution: killua99 commentedIt can sync the display setup?
Comment #4
joachim CreditAttribution: joachim commentedNo, it's just the instance settings form.
I'll take a patch for the display settings though :)
Comment #5
killua99 CreditAttribution: killua99 commentedUmmmm, ok :D hehehe let me see what can I do.
Maybe I just add an extra MENU_LOCAL_TASK and try to do the same but with the display settings.
Idk if create like a setup or something ... like the "image style" like.
1 - Chose name (and machine name)
2 - The wizard start and you pick a master bundle / entity display
3 - Then you chose from a list (of the same bundle / entity) display to sync
4 - a hook or something handle the request to keep it sync when you're editing the *main bundle* to the others.
Or you have a better idea?
Comment #6
joachim CreditAttribution: joachim commentedI would add another link in the table at admin/reports/fields/tools to edit display settings. It's not ideal, but it's the simplest thing :)
There, see if you can grab just the part of the display form for a single field. Given it's ajaxy, that may be tricky.
Comment #7
killua99 CreditAttribution: killua99 commentedEntity bundle display modes across bundles ... or in simple word cloning display mode into others bundles.
- What do we want?
- Replay easily the display settings to others bundles (content types)
- When do we want it?
- .....
And the answer comes ... when you apply this patch.
How you can use this new feature?
go to. admin/structure/types/manage/you-bundle/display-clone this will be your source settings to clone into others content type (bundles)
You can select which display mode you want, like admin/structure/types/manage/you-bundle/display-clone/full and then select the others content type you want to replay this settings.
This patch support display suite and field groups.
So I believe that cover the 80% of the case of use.
This also works for others entities like product (commerce) and works fine.
Comment #8
killua99 CreditAttribution: killua99 commentedOk some changes I did.
Still review ... someone?
Comment #9
joachim CreditAttribution: joachim commentedTypo: 'Retrieve'
Also, please add documentation for all the params and the return, if any.
Also, what does 'prnt' mean? Avoid abbrevs in variable names.
This is why we need @param docs, as I am already confused.
$bundle_name sounds like it's a string. But you're accessing it as an object.
Also, where was it defined? I don't see anything about it!
This should be broken up into more lines so it's clearer. There are no awards for managing to fit something on a single line ;)
There's quite a lot to do for both of these modules, so I am wondering whether we should split this off into either helper functions, or just invent a hook and then implement it on their behalf.
Would it make code more convoluted, or easier to read? Trying to keep functions short is definitely a good thing, so I am leaning towards splitting.
I'm confused about the related/non-related fields bit. Does this create new field instances? I'm not sure it should.
Comment #10
joachim CreditAttribution: joachim commented> I'm confused about the related/non-related fields bit
Actually I think I can see the use case.
I was thinking this would only let you copy the display settings for one instance of field_foo to other instances of field_foo.
But I can see that you might want to copy display settings from taxonomy term ref field_foo to taxo term ref field_bar. Which certainly makes things more complicated...
Comment #11
killua99 CreditAttribution: killua99 commentedUpdating the coding to the last dev code.
Hope you like it more. I add some @param description and correct other coding process.
Comment #12
Poieo CreditAttribution: Poieo commentedI applied your patch to the latest dev and you're missing a closing '}'.
Also, I can't for the life of me find the feature you added. There are no new tabs or buttons anywhere.
Lastly, how hard would it be to add the ability to modify all the widget types at the same time?
Comment #13
killua99 CreditAttribution: killua99 commentedPoieo I'll try a new one later ...
Comment #14
Salif CreditAttribution: Salif commentedHi
@ killua99
There is an issue on how to List all discounted products? (using commerce discount)
See https://www.drupal.org/node/2149777.
I think that the field tools module and your patch can be used in attempt to solve this issue if it's possible to use the same fields on products entity and discount.
What do you think?
Comment #15
rudins CreditAttribution: rudins commentedUpdated patch.
Now currently selected/active display mode is used as 'source display'. That means, settings could be synchronized to different display mode.
Comment #16
axe312 CreditAttribution: axe312 commentedThank you for your help gatis, here are some tweaks for the patch:
This can be removed, there is no reason for this check. It just produces notices:
field_tools.admin.inc - Line 1349
To improve the workflow, we should use checkboxes to clone into multiple displays. I tried to change the form element, but this is not working out of the box :/
Comment #17
joachim CreditAttribution: joachim commentedLooks like this is making good progress, but needs some more cleaning up.
Function docs first lines should be a verb in the 3rd person, eg "Retrieves yada yada". If you want to say it's internal only, you can do so in the next line.
What's a 'parent' in this context?
This needs to document the structure of the returned array.
There's no need to say this, we can see that from the lack of @return.
Is this singular or plural?
I don't understand this comment.
Also, I would seriously consider breaking up that big function that has the module_exists() with a hook pattern. Invent a hook_field_tools_instance_clone() (or whatever it is we're doing that that point) and then implement it on behalf of ds and field_group modules. That would make it a lot easier to read and keep it to a more manageable length.
Comment #18
mibfire CreditAttribution: mibfire commentedHow can i copy the all display settings from one entity type into another? Which patches should i use from here? Cos the "display-clone" path is not in the latest display-settings-across-bundles-2032735-15.patch. Thx
Comment #19
rudins CreditAttribution: rudins commented@mibfire, you are right, ...-15.patch lacks menu item definition.
Here is updated patch, which also includes modifications based on @joachim suggestions.
Comment #20
mibfire CreditAttribution: mibfire commentedrudins, THX!
Comment #21
mibfire CreditAttribution: mibfire commentedI have tryed to clone the default display of "erzekelok" product entity type to "fuvokak" product entity type but i got severel php errors:
PHP Warning: Missing argument 5 for field_tools_bundle_display_clone_from_form() in field_tools.admin.inc on line 1389, referer: /admin/commerce/config/product-variation-types/erzekelok
PHP Notice: Undefined variable: view_mode in field_tools.admin.inc on line 1397, referer: /admin/commerce/config/product-variation-types/erzekelok
PHP Notice: Undefined variable: view_mode in field_tools.admin.inc on line 1401, referer: /admin/commerce/config/product-variation-types/erzekelok
PHP Notice: Undefined index: in field_tools.admin.inc on line 1266, referer: /commerce/config/product-variation-types/erzekelok/display-clone
PHP Fatal error: Unsupported operand types in drupal/modules/field/field.crud.inc on line 630, referer: /admin/commerce/config/product-variation-types/erzekelok/display-clone
Now, display modes are radio boxes, but in this case only one can be copied. I think this should be a select list for multiple display modes copy.
Comment #22
rudins CreditAttribution: rudins commentedErrors are shown if Default display mode is selected. There was missing argument for view_mode in menu item callback.
I`ll check on multiple display clone option later.
Comment #23
mibfire CreditAttribution: mibfire commentedThx the quick fix!
Comment #24
mibfire CreditAttribution: mibfire commentedI applied this patch but i am still getting those errors.:(
Comment #25
rudins CreditAttribution: rudins commentedDid you cleared caches?
Comment #26
mibfire CreditAttribution: mibfire commentedDidnt, but i dont think it is needed.
Comment #27
rudins CreditAttribution: rudins commentedIt is needed, menu item definition is changed.
Comment #28
mibfire CreditAttribution: mibfire commentedYou were right. It is working, but the default display hasnt been changed.
Comment #29
mibfire CreditAttribution: mibfire commentedRudins, can you clone the commerce product entity display?
Comment #30
joachim CreditAttribution: joachim commentedI had a look at this and did a bit of further work on it:
- tidied up the message and added the bundle admin URL to it
- fields that are only in a destination bundle were set to visible on the view mode, which is not what I expected. I've changed that so they are hidden.
There's something weird going on with the call to _field_tools_clone_add_display_to_bundles() -- I've left a TODO in the code for now.
Comment #31
joachim CreditAttribution: joachim commentedOh and another thing that needs to be changed: this should be moved under the Tools tab, and the source view mode should be taken from a form element, not from the current tab location. It's rather wasteful of tabs to use them in this way.