我有一个自定义的drupal 7表单,如下所示
$form['general_details'] = array(
'#type' => 'fieldset',
'#title' => t('General'),
'#description' => t('General Information.'),
'#required' => TRUE,
);
$form['general_details']['salutation'] = array(
'#type' => 'select',....
我在“ $ form ['general_details'] ['salutation']”行中出现错误:错误:无法将字符串偏移量用作PHP7.2的数组
有人可以帮忙吗?预先感谢。
您必须先声明空数组,然后再分配它
$form = array();
$form['general_details'] = array(
'#type' => 'fieldset',
'#title' => t('General'),
'#description' => t('General Information.'),
'#required' => TRUE,
);
$form['general_details']['salutation'] = array(
'#type' => 'select',....