调用drupal_render()返回NULL

时间:2010-03-09 13:47:37

标签: php drupal drupal-render

我从昨天开始一直在寻找,但无法理解为什么拨打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
)
?>

知道我缺少什么吗?

1 个答案:

答案 0 :(得分:0)

检查此函数的drupal源:

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

你现在看到它如何返回null?