[DX] What happened to theme_node_preview() and what can people do now in its place.
I know that this sounds like a task for adding documentation and a change record, so better filed under https://github.com/backdrop-ops/docs.backdropcms.org/issues, however, there may be core-related things that we need to do, such as adding a wrapper function with a @deprecated and a watchdog message thrown etc.
This came up in a thread in Zulip:
Hi, in D7 we used
theme_node_previewto modify how a node is previewed before saving, and I'm trying to get the same result in Backdrop, but it seems that in Backdrop there's a different approach to doing this. But I can't understand what it is! It looks like I should usenode_preview. Can someone explain how this would be done?
Here's what we know:
- We've removed node previews completely in Backdrop v1.0.0 with #218 and https://github.com/backdrop/backdrop/pull/601
- We then re-introduced node previews much more improved in v1.11.0, with #3062 and https://github.com/backdrop/backdrop/pull/2290
- We iterated after that, with a series of follow-up bug fixes and UX improvements:
- #3275
- #3336
- #3338
- #3361
- #4856
- #5018
- #5067
Clues: In the original PR that reintroduced the node previews, there's a @see node_form_build_preview() in the docblock of node_preview(), however that eventually has changed to @see node_form_preview() later. I cannot see any theme function being called in that function, so not sure how people can override it 🤷🏼
PR available now. To test, override THEME_NAME_node_preview() in template.php. The render array will be available in $variables['node_preview']
Simple enough. I've tested and reviewed. RTBC
I agree with @herbdool, this is simple and looks good 👍🏼
Setting the milestone, and back to NW since there are some nits in the PR thread.
I've resolved all the PR comments, ready for review again.
Thanks @docwilmot, @klonos, @herbdool, and @kiamlaluno! I merged https://github.com/backdrop/backdrop/pull/4652 into 1.x for 1.28.0. It could have been backported to 1.27.2, but I added the @since 1.28.0 and that release is right around the corner, so I hope that should be acceptable.
Tiny follow-up PR to add further @since lines with additional details/links to the functions that have previously been removed and since re-added: https://github.com/backdrop/backdrop/pull/4725