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.
Hi,
I've made a small change to the 'execute php' form, so that after writing some code and executing it, the form textarea is expanded so that all the code lines can be seen without having to use the scroll bars. I am finding it very useful, as often I need to test a bit of php which is longer than five lines, but I was getting tired of always having to scroll to get the code lines at the end.
I will make a patch for this, and was wondering if you'd like to include it so that others may benefit?
Jonathan
Comment | File | Size | Author |
---|---|---|---|
#4 | _916940.devel_.size_of_php_textarea-d7.patch | 746 bytes | jonathan1055 |
#1 | _916940.devel_.size_of_php_textarea-d6.patch | 636 bytes | jonathan1055 |
Comments
Comment #1
jonathan1055 CreditAttribution: jonathan1055 commentedHere is the patch, against 6-x.1.22
It is a one-line change to devel_execute_form_submit() plus the necessary addition of & infront of the $form parameter. The original default of 5 lines is kept as a minimum.
Jonathan
Comment #2
salvisNice little tweak. But why don't you do this in devel_execute_form()?
We need a D7 version first.
Comment #3
jonathan1055 CreditAttribution: jonathan1055 commentedHi,
Glad you like it. I have found it very useful.
The reason I didn't do it in devel_execute_form() is that the code lines entered are not immediately available because the $form is not passed in as a parameter. If there is an easy way to get the pre-existing $form values into devel_execute_form() then let me know, but it is nice and simple as it stands, with the $form already being available in devel_execute_form_submit().
Regarding D7, I have just looked at devel_execute_form() and the previously executed php code is restored, via a $_SESSION variable which is saved in devel_execute_form_submit(). So in D7 it would be possible to set the size in devel_execute_form(). I think this is what I'll do for the D7 patch because it is neater.
Jonathan
Comment #4
jonathan1055 CreditAttribution: jonathan1055 commentedHere is the patch for D7. Simpler than for D6.
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedNow that we collapse this textarea by default when used in a block (I was not even aware we did this), we should just substantially increase the rows by default and move on. My .02
Comment #6
jonathan1055 CreditAttribution: jonathan1055 commentedYes, increase the number of rows by all means. What size were you thinking of?
Is there a way within devel_execute_form() to tell whether it is the full page version or the block version?
Comment #7
salvisI'd say we go from the current (default) 5 to 20. That's about 400 pixels high and the same height as the default node body entry field.
That should work for the block as well as for the devel/php page. Why would you want to make them different in size?
Comment #8
salvisComment #9
salvisSet height to 20 rows. Committed to D6 and D7.