Code seen in Drupal's core (text.module):

/** 
 * Implement hook_field_info(). 
 */
function text_field_info() {
  return array(
    'text' => array(
      'label' => t('Text'),
      'description' => t('This field stores varchar text in the database.'),
      'settings' => array('max_length' => 255),
      'instance_settings' => array('text_processing' => 0),
.
.
.

/** 
 * Implement hook_field_widget_info(). 
 */
function text_field_widget_info() {
  return array(
    'text_textfield' => array(
      'label' => t('Text field'),
      'field types' => array('text'),
      'settings' => array('size' => 60),
.
.
.

Why is 'field types' with space but 'instance_settings' with underscore?

Comments

aspilicious’s picture

Anyone?

sun’s picture

Component: other » field system
Issue tags: +API change

Most of array keys in Drupal core use spaces, not underscores. But with most, I merely mean hook_menu() and other things. Form API comes with its own nightmare of inconsistent key names.

Would be lovely to fix that. But not sure whether it'll be accepted.

aspilicious’s picture

API change? In that case we have to push this to D8...

mr.baileys’s picture

Version: 7.x-dev » 8.x-dev

Unfortunate, but too late in the game to change this so bumping to D8.

pillarsdotnet’s picture

Title: Inconsistent use of underscores/spaces in keys? » Replace all underscores with spaces in Field API keys, for consistency.
Category: bug » task

Re-titling.

tim.plunkett’s picture

sub

traviscarden’s picture

swentel’s picture

Status: Active » Closed (fixed)

D8 has settled doing everything with underscores, so this is fine already.