当它说:(它来自drupal的hook_block_view代码时)我不知道它是什么意思
$ block ['content'] = array('#theme'=>'node_recent_block','#node'=> $ nodes,);
我知道$ block ['content']是一个关联数组,我也知道$ node是Full节点对象,包含可能不安全的数据。但是关于#theme,#node和'node_recent_block。 有人可以告诉我他们的意思。
我搜索了很多但是我没有发现当一个键的名字前面有一个#时它是什么意思。 谢谢
I do not know what does it mean when it says: (it is from hook_block_view code for drupal)
$block['content'] = array( '#theme' => 'node_recent_block', '#nodes' => $nodes, );
I know $block['content'] is an associative array, also I know that $node is Full node object, Contains data that may not be safe.But about #theme, #nodes and 'node_recent_block. Can someone please tell me what do they mean.
I searched a lot but I did not find out what does it mean when there is a # before name of a key. Thank you
最满意答案
$ block是一个关联数组,其中元素“content”也是一个关联数组。
另一种定义方法是:
$block = array( 'content' => array( '#theme' => 'node_recent_block', '#nodes' => $nodes, ), );在关联数组内部=>是一个赋值。
'content'是一个数组,其中'#theme'='node_recent_block'和'#nodes'= $ nodes
编辑:
您也可以像这样分配值:
$block['content']['#theme'] = 'node_recent_block'; $block['content']['#nodes'] = $nodes;$block is an associative array, in which the element "content" is also an associative array.
Another way to define this would be:
$block = array( 'content' => array( '#theme' => 'node_recent_block', '#nodes' => $nodes, ), );Inside an associative array => is an assignment.
'content' is an array where '#theme' = 'node_recent_block' and '#nodes' = $nodes
Edit:
You could also assign the values like this:
$block['content']['#theme'] = 'node_recent_block'; $block['content']['#nodes'] = $nodes;更多推荐
发布评论