0

我从昨天开始就一直在寻找,但不明白为什么一个电话drupal_render()会返回NULL。在我的节点主题函数中,当我像下面这样定义调用时,它什么也不渲染drupal_render($element)$element

<?php
Array
(
    [#type] => textfield
    [#title] => Label
    [#default_value] => 
    [#post] => Array
        (
        )

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

    [#array_parents] => Array
        (
            [0] => range
            [1] => label
        )

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

    [#required] => 
    [#input] => 1
    [#size] => 60
    [#maxlength] => 128
    [#autocomplete_path] => 
    [#process] => Array
        (
            [0] => form_expand_ahah
        )

    [#name] => label
    [#id] => edit-label
    [#value] => 
    [#defaults_loaded] => 1
    [#sorted] => 1
    [#printed] => 1
)
?>

知道我缺少什么吗?

4

1 回答 1

0

检查此功能的drupal源:

if (!isset($elements) || (isset($elements['#access']) && !$elements['#access'])) {
    return NULL;
  }

您现在看到它如何返回 null 了吗?

于 2010-03-09T15:42:29.170 回答