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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeffschuler’s picture

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

salvis’s picture

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?

jeffschuler’s picture

Status: Active » Needs review
FileSize
1.31 KB

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.

salvis’s picture

Status: Needs review » Needs work

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

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

jeffschuler’s picture

Status: Needs work » Needs review
FileSize
1.45 KB

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

jeffschuler’s picture

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.

jeffschuler’s picture

D6 version using isset()...

salvis’s picture

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.

salvis’s picture

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

jeffschuler’s picture

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.

jeffschuler’s picture

Status: Needs work » Needs review
salvis’s picture

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!

salvis’s picture

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.

salvis’s picture

Status: Needs work » Needs review
FileSize
2 KB

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.

moshe weitzman’s picture

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

salvis’s picture

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

Anyone give it a try?

Garrett Albright’s picture

Status: Needs review » Reviewed & tested by the community

Verification! Thanks, jeff and salvis.

salvis’s picture

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.

salvis’s picture

Status: Patch (to be ported) » Fixed

Committed to D6.

Status: Fixed » Closed (fixed)

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