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.
Now we have moved to psr-0 and make heavy use of classes/namespaces etc... it would make sense to allow the '#pre_render' and '#post_render' callback arrays to process any php callable and not just a function. This would promote better code organisation. For a good example of this, see views_handler_field_custom_pre_render_move_text in views.module.
Comment | File | Size | Author |
---|---|---|---|
#15 | 1993312-15.patch | 3.7 KB | damiankloip |
#15 | interdiff-1993312-15.txt | 1.15 KB | damiankloip |
#14 | callables-1993312-14.patch | 3.42 KB | tim.plunkett |
#14 | interdiff.txt | 1.56 KB | tim.plunkett |
#11 | 1993312-11.patch | 3.28 KB | damiankloip |
Comments
Comment #1
damiankloip CreditAttribution: damiankloip commented.
Comment #2
aspilicious CreditAttribution: aspilicious commentedWorks for me :)
Comment #3
tim.plunkettWe need this to finish #1982138: Clean out field_ui.admin.inc
Comment #4
yched CreditAttribution: yched commented+1 for this, of course.
But more generally, rather than keeping with one-off "this callback" and "oh, this one too" patches, it might be a good idea to check all remaining render and form callbacks and make sure they consistently accept callables ?
Comment #5
damiankloip CreditAttribution: damiankloip commentedThat sounds good to me, let's get this in now so we can continue with our views and field patches though. If none else does first, I will create an issue in the morning.
Comment #6
tim.plunkettIt seems the only remaining one is #after_build, let's just finish this off right.
Comment #7
damiankloip CreditAttribution: damiankloip commentedYeah, why not.
Comment #8
tim.plunkettBeautiful, thanks!
Comment #10
tim.plunkettApparently this will need to be call_user_func_array()? call_user_func() doesn't work with references
Comment #11
damiankloip CreditAttribution: damiankloip commentedAh, that is good to know.
Comment #13
dawehnerJust in general: do we have to convert all of them to cufa?
Let's also change after_build, post_render
Comment #14
tim.plunkettI looked into it, those docs are wrong.
And this is what was needed for the references to work. cufa is exempt from the call time pass-by-reference rules.
Comment #15
damiankloip CreditAttribution: damiankloip commentedYep, let's do that.
Comment #16
aspilicious CreditAttribution: aspilicious commentedOk we should be good now. Docs and code look good.
Comment #17
alexpottCommitted 523d64a and pushed to 8.x. Thanks!