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.
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.
Comment | File | Size | Author |
---|---|---|---|
#14 | devel_execute.608734.14.patch | 2 KB | salvis |
#10 | 608734-collapsible-d6_7.patch | 1.91 KB | jeffschuler |
#7 | 608734-collapsible-d6_3.patch | 1.45 KB | jeffschuler |
#6 | 608734-collapsible-d7_1.patch | 1.41 KB | jeffschuler |
#5 | 608734-collapsible_2.patch | 1.45 KB | jeffschuler |
Comments
Comment #1
jeffschulerAnother 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...
Comment #2
salvisI 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?
Comment #3
jeffschulerThanks 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.
Comment #4
salvisDidn't you want to put the button into the fieldset?
We'll need a patch for D7, too...
Comment #5
jeffschulerThanks for checking this out.
Good point... Here's an updated D6 patch with the button inside the fieldset.
Comment #6
jeffschulerHere'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.
Comment #7
jeffschulerD6 version using isset()...
Comment #8
salvisBoth versions look and work fine. Thanks.
We'll address the losing of the code in D7 after this is committed.
Comment #9
salvisI'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...
Comment #10
jeffschulerAnother 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.
Comment #11
jeffschulerComment #12
salvisRTBC 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!
Comment #13
salvisWe're not making any progress here. If you're still interested, then please try to provide a D7 patch first.
Comment #14
salvisOk, here's another stab at a D7 fix, which also preserves the code in the textarea as mentioned in #6 and #757820: "Execute PHP" form no longer remembers last submitted value.
Comment #15
moshe weitzman CreditAttribution: moshe weitzman commentedcode looks good. lets change session var name to devel_execute_code. if someone can verify that this works, its rtbc.
Comment #16
salvisOk, will change the name, thanks for taking a look!
Anyone give it a try?
Comment #17
Garrett Albright CreditAttribution: Garrett Albright commentedVerification! Thanks, jeff and salvis.
Comment #18
salvisThanks, Garrett!
Committed to D7.
Comment #19
salvisCommitted to D6.