小编Chr*_*Lai的帖子

修改Drupal表单字段 - 数组中的[#weight]不受尊重?

我没有PHP的经验.我已经按照一些教程使用template.php中的theme方法修改我的Drupal表单.

由于某种原因,字段的[#weight]属性不符合其值.我想在主题字段[subject]上方移动Category字段[cid].这些是我使用的代码行:

$form['cid']['#weight'] = 0.003;
$form['subject']['#weight'] = 0.004;
Run Code Online (Sandbox Code Playgroud)

当我打印我的数组进行查看时,我看到值已经改变,但是当我渲染表单时,没有进行任何更改.每次修改后我都已经清除了性能缓存.

如果您对此感兴趣,请阅读我的打印数据片段:

[subject] => Array
        (
            [#type] => textfield
            [#title] => Subject
            [#maxlength] => 255
            [#required] => 1
            [#post] => Array
                (
                )

            [#programmed] => 
            [#tree] => 
            [#parents] => Array
                (
                    [0] => subject
                )

            [#array_parents] => Array
                (
                    [0] => subject
                )

            [#weight] => 0.004
            [#processed] => 1
            [#description] => 
            [#attributes] => Array
                (
                )

            [#input] => 1
            [#size] => 60
            [#autocomplete_path] => 
            [#process] => Array
                (
                    [0] => form_expand_ahah
                ) …
Run Code Online (Sandbox Code Playgroud)

php forms drupal field

4
推荐指数
1
解决办法
6161
查看次数

标签 统计

drupal ×1

field ×1

forms ×1

php ×1