开发者

PHP/Drupal - Pound sign on array

Hi

When I print o开发者_运维知识库ut the variable, I got pound sign on the array as below:

...
[#weight] => 0
[#theme] => text_formatter_default
[#field_name] => field_product_item_no
[#type_name] => product
...

What is the meaning of Pound sign?

Thanks


This is just the way the Drupal Forms API expects its data.


In Drupal, [#key]'s value is metadata, whereas [key]'s value is data.

According to the answer given to my question about "#" properties on the Drupal Stackexchange,

Put simply, array keys in a render array without a # in front of the name are seen as children of the render array, and are subsequently rendered themselves (recursively).

Those with a # in front of theme are seen as meta data/variables for the render array to use as necessary, and are not themselves rendered.


The pound sign is just a valid character as array key and has no special meaning in PHP besides a convention defined by the application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜