Drupal仅在节点类型上显示块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Drupal仅在节点类型上显示块相关的知识,希望对你有一定的参考价值。

  1. <?php
  2. // Only show if $match is true
  3. $match = false;
  4.  
  5. // Which node types
  6. $types = array('book', 'news', 'anothernodetype' );
  7.  
  8. // Match current node type with array of types
  9. if (arg(0) == 'node' && is_numeric(arg(1))) {
  10. $nid = arg(1);
  11. $node = node_load(array('nid' => $nid));
  12. $type = $node->type;
  13. $match |= in_array($type, $types);
  14. }
  15.  
  16. return $match;
  17. ?>

以上是关于Drupal仅在节点类型上显示块的主要内容,如果未能解决你的问题,请参考以下文章