A fatal error without any of your code in the backtrace: check your form_alter
Fatal error: Cannot use string offset as an array in /home/ben/code/pdonline/drupal/includes/form.inc on line 976
Call Stack
# Time Memory Function Location
1 0.0019 64260 {main}( ) ../index.php:0
2 2.7990 23389320 menu_execute_active_handler( ) ../index.php:18
3 2.8490 23579028 call_user_func_array ( ) ../menu.inc:348
4 2.8490 23579192 node_add( ) ../menu.inc:0
5 2.8490 23580296 drupal_get_form( ) ../node.pages.inc:58
6 3.3649 29258140 drupal_process_form( ) ../form.inc:119
7 3.3649 29261700 form_builder( ) ../form.inc:394
8 3.4317 29930884 form_builder( ) ../form.inc:914
9 3.4397 29985960 form_builder( ) ../form.inc:914
10 3.4399 29986204 form_builder( ) ../form.inc:914
11 3.4400 29986712 form_builder( ) ../form.inc:914
12 3.4401 29988276 form_builder( ) ../form.inc:914
13 3.4402 29988988 _form_builder_handle_input_element( ) ../form.inc:873
I managed to cause this in an implementation of hook_form_alter (not in any of the files listed in the backtrace) simply by using an array path that doesn't exist.
<?php
$form['field_author']['widget']['default_value'][0]['uid'] = $user->uid;
?>
Needed another zero. (Well, the whole path was whack. The below does work, and in a an appropriate hook_form_alter will automatically set the Agaric made a module out of this– a bit overkill, and assuming any time a userreference field is named "author" it should default to the current user as an author.)
<?php
$form['field_author'][0]['#default_value']['uid'] = $user->uid;
?>
Don't know if it will ever be committed, but if you want it ask for the author_field module! We'll know you read past a giant error message to find out about it.
Comments
Can get a similar error
forgetting to put # in your element definitions.
http://api.drupal.org/api/function/hook_form_alter
<?php
$form['agaricexample'] = array(
'#type' => 'markup',
'#value' => t('Nothing much to say'),
);
?>
It's leaving out the pound symbol before type or value that will cause the errors.
Post new comment