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.
I'd like to be able to lay out a custom form created using the Bean API with display suite (ds_forms & rel modules). I'm wondering if registering the form elements using hook_field_extra_fields() would help? See #1490328: Adding fields to node edit form via hook_form_alter and placing them in DS regions.
Also, the bean form's ID is always bean_form which means that if display suite is customising the form and extra fields are added in DS all other bean forms get these elements added. Would it be possible to change the form ID to something like bean_form_{$bean_type}?
Comment | File | Size | Author |
---|---|---|---|
#17 | make_custom_bean-1534722-17.patch | 4.4 KB | gordon |
| |||
#16 | make_custom_bean-1534722-16.patch | 4.83 KB | gordon |
#15 | make_custom_bean_forms-1534722-15.patch | 4.41 KB | gordon |
#5 | bean-1534722-extra-fields-support.patch | 946 bytes | skwashd |
#3 | bean-extra-field-support-1534722-2.patch | 534 bytes | broeker |
Comments
Comment #1
indytechcook CreditAttribution: indytechcook commentedI like this idea. It's good Drupal practice also.
Comment #2
indytechcook CreditAttribution: indytechcook commentedPulling related issue #1647542: Making Bean Title accessible to Views Mode
Comment #3
broeker CreditAttribution: broeker commentedHere is a patch that provides support for hook_field_extra_fields().
In my case, I am just using hook_entity_view() in a custom module to handle the actual output, but this patch provides the necessary support for the Manage Display UI within the Beans admin. This allows you to drag and drop your title ("Bean field: Title") within your view mode. I'm not actually using Display Suite, so I'm not sure how they handle the field output or if you will need additional steps to actually alter your view mode, but this patch will be required either way and should cause the Bean field: Title field to show up in the view modes UI.
Comment #4
indytechcook CreditAttribution: indytechcook commentedSetting to Needs review so testbot can run.
Comment #5
skwashd CreditAttribution: skwashd commentedThe patch from @broeker at #3 looks good to me. I think it is good to allow users to be able to reorder the fields in the form too, so I've added that to the patch.
Comment #6
indytechcook CreditAttribution: indytechcook commentedLooks good to me!
Comment #7
indytechcook CreditAttribution: indytechcook commentedhttp://drupal.org/commitlog/commit/22232/ce842fd477bb08468350bdcc4d40fa8...
Comment #8
johnnybgoode CreditAttribution: johnnybgoode commentedimplementation of hook_block_view_alter to support the title field added by hook_extra_fields in the patch from #5.
Comment #10
mducharme CreditAttribution: mducharme commentedThe default Bean title is still not configurable in Display Suite as per #1647542: Making Bean Title accessible to Views Mode.
I tried using the extra fields DS feature with the entity|bundle|field setting of "bean|my_block_type|title" but it basically breaks the title field (can provide details if useful).
Comment #11
oxyc CreditAttribution: oxyc commentedI made a quick module to support this better. It replaces the beans own extra field and adds a ds field with the same settings as nodes/terms/etc (setting heading tag, classes etc).
https://github.com/generoi/bean_ds
Comment #12
davidwbarratt CreditAttribution: davidwbarratt commentedoxyc,
Can you put your module on Drupal.org?
Thanks!
Comment #13
Leo Pitt CreditAttribution: Leo Pitt commentedI've worked around the problem of bean title fields not respecting manage display settings using the https://www.drupal.org/project/title module.
Use it to replace the bean title field with a field entity - this will place the title field into the content array where it can be properly managed via display settings and display suite.
You'll then have two titles - one coming from the block template h2 and the other from the content array. I created a new block template block--bean.tpl,php with the title h2 removed and that seems to work.
Comment #14
Leeteq CreditAttribution: Leeteq commentedhttps://github.com/generoi/bean_ds - "Deprecated in favour of"..: https://github.com/generoi/ds_contrib
Comment #15
gordon CreditAttribution: gordon at Heydon Consulting commentedI needed this fixed, and also found a problem in display suite that stopped the title from displaying when overriding the layout. I have submitted the issue #2908712
Here is my patch to bean which adds ds support.
Comment #16
gordon CreditAttribution: gordon at Heydon Consulting commentedI merged in the previous patch which also makes it compatible with bean forms as well.
Comment #17
gordon CreditAttribution: gordon at Heydon Consulting commentedOpps, broke something.
Comment #19
DamienMcKennaComment #20
MaxMendez CreditAttribution: MaxMendez commentedTested patch #17 and works fine in my environment.