Make Execute PHP Block Collapsible
jeffschuler - October 19, 2009 - 17:50
| Project: | Devel |
| Version: | 6.x-1.x-dev |
| Component: | devel |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
Could the Execute PHP block be [javascript'ly] collapsible?
I like to keep it around while developing, but it takes up screen/mind real estate.
Ideal solution might be an AJAX-y overlay -- a sort of combination of the Execute PHP menu item & block -- but the ability to collapse the block would be a nice step in the non-obtrusive-but-available direction.

#1
Another justification for doing this:
I typically keep the Execute PHP block in the Content Bottom region on sites where there's no room in the footer...
So, the Execute button becomes the bottom button on forms, instead of the Form's Submit, facilitating some minor mixups and hesitation~inefficiencies...
#2
I like the idea (but moshe calls the shots). Collapse it by default if the textarea is empty and expand it if it isn't.
Care to submit a patch?
#3
Thanks for liking the idea!
Here's a patch.
I removed the block title and use the fieldset title, as that space is there just asking to be used, and it makes things a little more compact.
Not sure if there's something better than $_POST to figure out if the code block has text...
Thanks for any feedback.
#4
Didn't you want to put the button into the fieldset?
We'll need a patch for D7, too...
#5
Thanks for checking this out.
Good point... Here's an updated D6 patch with the button inside the fieldset.
#6
Here's a D7 version, (though I haven't changed the version on this Issue.)
Changed ==NULL to isset(). I'll make the same change in the D6 version...
Looks like the code inside the Execute textfield isn't preserved after a form submit, but that happens regardless of whether this patch is applied.
#7
D6 version using isset()...
#8
Both versions look and work fine. Thanks.
We'll address the losing of the code in D7 after this is committed.
#9
I've been using this for a while now and it's nice, except on devel/php: the fieldset should never be collapsed there.
Something like
$_GET['q'] != 'devel/php'should help...Let's raise the priority a little and hope we'll eventually catch moshe's interest...
#10
Another good point ~ thanks salvis.
The attached patch does uses the fieldset only when not on the devel/php page, though it maintains
$form['execute']['code'](instead of the old$form['code']) for the sake of code simplicity. Let me know if this is a bad idea.It also sets default settings for the Execute PHP block -- preventing duplication by not displaying it on the Execute PHP page.
#11
#12
RTBC for D6. The patch doesn't apply to D7.
The code to avoid duplication on devel/php only works during first-time installation of Devel, but that's already an improvement over what we have now. Admins who have the block enabled are unlikely to go there anyway.
My complaint in #9 is fully addressed, thanks!