Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 6 Drupal配置文件更改:hook\u form\u更改_Drupal 6 - Fatal编程技术网

Drupal 6 Drupal配置文件更改:hook\u form\u更改

Drupal 6 Drupal配置文件更改:hook\u form\u更改,drupal-6,Drupal 6,在查看了这里和其他地方的一些帖子之后,我似乎仍然无法手动将select字段添加到配置文件中。(我需要用SQL查询填充选择列表,核心概要文件模块不支持该查询。) 到目前为止,我尝试了两种不同的方法:hook form alter($form_id=='user register'&hook user($op=='register')——但我甚至无法让字段出现在注册表单中 function accountselect_user($op, &$edit, &$account,

在查看了这里和其他地方的一些帖子之后,我似乎仍然无法手动将select字段添加到配置文件中。(我需要用SQL查询填充选择列表,核心概要文件模块不支持该查询。)

到目前为止,我尝试了两种不同的方法:hook form alter($form_id=='user register'&hook user($op=='register')——但我甚至无法让字段出现在注册表单中

    function accountselect_user($op, &$edit, &$account, $category = NULL) {
    if ($op == 'register'){
    $fields['account_select'] = array(
    '#type' => 'fieldset',
    '#title' => t('Your Security Question')
    );
    $fields['account_select']['account_name'] = array(
    '#type' => 'select',
    '#default_value' => 'Select',
    '#description' => t('Select a verification question in case you forget your password'),
    '#options' => array(t('Select One'),
    t('Where you attended Elementry School'), t('Your Best Man'))
    );
return $fields;
    }
这是钩子的形状

  function accountselect_form_alter(&$form, $form_state, $form_id){
              if($form_id == 'user-register')   {
               $form['account_select']['account_name'] = array(
               '#type' => 'select',
               '#title' => t('Account'),
               '#description' => t('Enter the account to which the contact belongs.'),
               '#options' => array(t('Account1'),t('account2'), t('account3')),
               '#default_value' => $edit ['Account']
               );
               }
               return $fields;
            }

对不起,伙计们,这里的代码是正确的。我在第一次启用模块时做了一点调试。我以为我已经成功地解决了问题,但真正发生的是模块被禁用了。因此,无论模块中有什么,都不会有任何效果


不用担心,我已经为这个愚蠢的问题打了自己的脸……

对不起,伙计们,这里的代码是正确的。当模块第一次启用时,我做了一点调试。我以为我已经成功地解决了这个问题,但真正发生的是模块被禁用了。因此,无论模块中有什么,它都没有任何效果。


别担心,我已经因为这个愚蠢的问题打了自己的脸……

我有过类似的事情发生在一个模块本身禁用上,可能是因为它工作不正常……你应该为一个写得好的问题投票,并且站出来承认你犯了错误。我有过类似的事情发生在一个模块本身禁用上,probab因为它不正确…你应该为一个写得很好的问题投票,并且站出来承认你犯了错误。