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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan1055’s picture

Status: Active » Needs review
FileSize
636 bytes

Here 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

salvis’s picture

Status: Needs review » Needs work

Nice little tweak. But why don't you do this in devel_execute_form()?

We need a D7 version first.

jonathan1055’s picture

Hi,
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

jonathan1055’s picture

Version: 6.x-1.22 » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
746 bytes

Here is the patch for D7. Simpler than for D6.

moshe weitzman’s picture

Now 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

jonathan1055’s picture

Yes, 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?

salvis’s picture

Version: 7.x-1.x-dev » 6.x-1.22
Status: Needs review » Needs work

I'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?

salvis’s picture

Version: 6.x-1.22 » 7.x-1.x-dev
salvis’s picture

Status: Needs work » Fixed

Set height to 20 rows. Committed to D6 and D7.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.