Problem/Motivation
I needed a way to add a preview column in the IEF table.
Proposed resolution
Allow to add a render callback for a cell in hook_inline_entity_form_table_fields_alter()
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | inline_entity_form-add_callback_field_type-2324901-3.patch | 2.01 KB | yannickoo |
| #2 | inline_entity_form-add_callback_field_type-2324901-2.patch | 1.86 KB | axe312 |
Comments
Comment #1
marcusx commentedI had the same use case as #2287391: Add entity_view field type for theme_inline_entity_form_entity_table but saw this to late. I came up with a different solution. But here is the patch anyway. I would highly appreciate if at least one solution would make it into IEF.
Usage example
Comment #2
axe312 commentedI added the entity type as callback parameter to improve the support of rendering entities in the callback.
To simplify the usage, I created a module which implements a preview view mode and table column for every entity. You can find it here: https://www.drupal.org/project/inline_entity_form_preview
Comment #3
yannickooThank you for sharing, nice thing!
This description should break after 80 characters.
You will get a fatal error when the function does not exist in code.
I fixed that two issues in the attached patch.
Comment #4
joelpittetAwesome, I closed my original issue and this approach seems to win out:) Either way we win, just putting focus one this issue!
Cheers and thanks for the code and the cleanups.
Comment #5
bojanz commentedCommitted, thanks.
Comment #7
axe312 commentedAwesome, thank you :)
Comment #8
joelpittetSo much awesome!
Comment #9
joachim commentedThis patch has invented a new callback. Callbacks should be documented in a similar way to hooks: see https://www.drupal.org/node/1354:#functions