Portfolio | Contact
Home » Blogs » deekayen's blog

Zend Studio for Eclipse Drupal formatter

For years I've been a paying customer of Zend, using their Zend Studio Professional. They discontinued production of their custom Java version and opted to switch to making plugins for Eclipse.

I'm just now switching from the old Zend to the new one and discovered a formatter to handle all the code spacing automatically. Naturally, since I do most of my work with Drupal, I made a custom formatter file to follow coding standards for 4.7.x to 6.x. There have been some standards changes to take effect for D7, and I'm not coding for that yet, so this should be a good file for a general audience.

In your Zend for Eclipse, go to the preferences, PHP section, Formatter and Import... the attached XML file.

Don't forget to also run your code through the coder module, which will not only check your coding style, but look for upgrades, database injections, and some other cool things.

To my knowledge, PDT 2.0 doesn't have a formatter interface like Zend Studio 6 has. However, it does have another feature I insist on, removal of trailing whitespace.

Preferences - PHP - Editor - Save Actions - Remove trailing whitespace

AttachmentSize
Drupal.xml18.17 KB

Submitted by deekayen on Mon, 05/05/2008 - 12:33pm

deekayen's blog | Printer-friendly version

Just downloaded this

Just downloaded this formatter. Thanks for the share!

reply

I Think there should be new

I Think there should be new lines for each array element

reply

Does anyone know if it

Does anyone know if it possible to configure the formatter in Zend studio to put a newline between each array element?

reply

One stupid question (I hope)...

I downloaded and imported your formatter. Thank you! Now the (stupid) question: how can I tell Eclipse (pardon, Zend Studio) to use this formatter with files ending with .module and not only .php?

marco

reply

File associations navigation

General - Content Types - Text - PHP Content Type - Add

.module .install

You might also want to click on the collapsible Text heading. It'll have .txt and you can add .info.

reply

Does it work in Zend Studio

Does it work in Zend Studio 6.01?

Thanks.

reply

yes

That's what I wrote it in.

reply

Thank you so much for this

Thank you so much for this formatter. I am not a Drupal developer, but I quiver every time I hit the format button with ZSE Standard format. This is the first google search I've done, but it looks pretty good to me.

Thanks!

reply

Post new comment

  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <hr /> <a> <p> <em> <strong> <cite> <code> <blockquote> <ul> <ol> <li> <dl> <dt> <dd>
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.