Hello all,

I'm not sure if this is the right place to ask this question and I'm sorry if I'm not. I couldn't find a better topic for this.

My question relates to coding standards for Drupal 7.

For variable declaration additional spaces are allowed to improve readability.
See: Function Call

But this is not written/documented for array definition.
See: Arrays

Therefore I'm wondering if it is allowed to add additional spaces in array declaration to improve readability?

Preview of what I mean to improve readability. (Or is this just me?)

$form['title'] = array(
  '#type'        => 'textfield',
  '#title'       => t('Title'),
  '#size'        => 60,
  '#maxlength'   => 128,
  '#description' => t('The title of your node.'),
);

Comments

Jeff Burnz’s picture

I've only seen it in core in one place, and I think it's actually a mistake (overlooked), however unless you're developing for core or trying to get a git account on D.O frankly, who cares?

fonteijne’s picture

Thank you Jeff for responding to my question.

I guess when I work solely on projects, it indeed can be in the category 'Who Cares?' ;-).
But as my team/company is developing in Drupal Coding Standards, I cannot apply this 'trick'.
Therefore I was wondering if there was a specific reason for it. ;-)

jaypan’s picture

Run it through the coder module and see if it passes. That's the easiest way to tell if it falls within Drupal coding standards.


Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.