Download & Extend

Make Execute PHP Block Collapsible

Project:Devel
Version:6.x-1.x-dev
Component:devel
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

Comments

#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

Status:active» needs review

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.

AttachmentSizeStatusTest resultOperations
608734-collapsible_1.patch1.31 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 608734-collapsible_1.patch.View details

#4

Status:needs review» needs work

Didn't you want to put the button into the fieldset?

We'll need a patch for D7, too...

#5

Status:needs work» needs review

Thanks for checking this out.
Good point... Here's an updated D6 patch with the button inside the fieldset.

AttachmentSizeStatusTest resultOperations
608734-collapsible_2.patch1.45 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 608734-collapsible_2.patch.View details

#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.

AttachmentSizeStatusTest resultOperations
608734-collapsible-d7_1.patch1.41 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#7

D6 version using isset()...

AttachmentSizeStatusTest resultOperations
608734-collapsible-d6_3.patch1.45 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 608734-collapsible-d6_3.patch.View details

#8

Status:needs review» reviewed & tested by the community

Both versions look and work fine. Thanks.

We'll address the losing of the code in D7 after this is committed.

#9

Priority:minor» normal
Status:reviewed & tested by the community» needs work

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.

AttachmentSizeStatusTest resultOperations
608734-collapsible-d6_7.patch1.91 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 608734-collapsible-d6_7.patch.View details

#11

Status:needs work» needs review

#12

Status:needs review» reviewed & tested by the community

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!

#13

Version:6.x-1.x-dev» 7.x-1.x-dev
Status:reviewed & tested by the community» needs work

We're not making any progress here. If you're still interested, then please try to provide a D7 patch first.

#14

Status:needs work» needs review

Ok, 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.

AttachmentSizeStatusTest resultOperations
devel_execute.608734.14.patch2 KBIdlePASSED: [[SimpleTest]]: [MySQL] 0 pass(es).View details

#15

code looks good. lets change session var name to devel_execute_code. if someone can verify that this works, its rtbc.

#16

Ok, will change the name, thanks for taking a look!

Anyone give it a try?

#17

Status:needs review» reviewed & tested by the community

Verification! Thanks, jeff and salvis.

#18

Version:7.x-1.x-dev» 6.x-1.x-dev
Status:reviewed & tested by the community» patch (to be ported)

Thanks, Garrett!

Committed to D7.

#19

Status:patch (to be ported)» fixed

Committed to D6.

#20

Status:fixed» closed (fixed)

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

nobody click here