How do I resolve the "Argument 1 passed to drupal_attributes() must be an array" error on my system_settings_form()? I don't usually post specific questions like this, and ask for help on a specific issue but I am at the end of my rope wasting time way...

I have a simple D7 module as seen below, when I load the page (who's menu item is exactly where I want it to be) I get the following error:


  Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given, called in /path/to/site/public_html/includes/form.inc on line 3106 and defined in drupal_attributes() (line 2257 of /path/to/site/public_html/includes/common.inc).


as you can see the form declaration itself is very simple, and everything runs peachy keen until the page load.

note, that I have looked at: 3106 in form.inc and the $element is populated but attributes doesn't exist - what am I missing???

&lt;?php
/**
 * Implements hook_menu().
 */
function attach_images_menu() {

    $items['admin/structure/types/manage/%/attach/images'] = array(
        'title' =&gt; 'Attach: Images',
        'page callback' =&gt; 'attach_images_settings',
        'access arguments' =&gt; array('access administration pages'),
        'weight' =&gt; '10',
        'type' =&gt; MENU_LOCAL_TASK,
    );

    return $items;

}

function attach_images_settings() {
    //$content_type = arg(4);
    $form['attach_images_amount_'] = array(
         '#type'   =&gt; 'textfield',
         '#title'  =&gt; 'Amount',
         '#default_value' =&gt; variable_get('attach_images_amount_',1),
    );
  return system_settings_form($form);
}

?&gt;
$items['admin/structure/types/manage/%/attach/images'] = array(
    'title' =&gt; 'Attach: Images',
    'page callback' =&gt; 'attach_images_settings',
    'access arguments' =&gt; array('access administration pages'),
    'weight' =&gt; '10',
    'type' =&gt; MENU_LOCAL_TASK,
);


This should be 'page callback' =&gt; 'drupal_get_form', 'page arguments' =&gt; array('attach_images_settings'). (don't forget to clean the cache after making the change)

Also, form callbacks in Drupal 7 have a mandatory $form argument.