繁体   English   中英

如何访问 Drupal7 的自定义模板文件中的内容类型描述?

[英]How to access content type description in custom template file of Drupal7?

我想访问 Drupal7 网站的自定义模板文件中的内容类型描述。 在这个模板文件中,我显示了内容列表。 现在,在该列表的顶部,我还想显示该内容类型的描述。

使用它可以访问内容类型名称。 还有什么方法可以访问描述吗?

$types = node_type_get_names('names');

在 drupal 论坛中找到了这个,但 node_get_types function 抛出错误。

$types = node_get_types();
print $types['blog']->description;

我想你可能正在寻找

node_type_get_types

https://api.drupal.org/api/drupal/modules%21node%21node.module/function/node_type_get_types/7.x

有人在 api 文档中发布了 object 的转储,但为了完整起见,我将其复制到此处。

Array
(
[article] => stdClass Object
  (
  [type] => article
  [name] => Article
  [base] => node_content
  [module] => node
  [description] => Use articles for time-sensitive content like news, press releases or blog posts.
  [help] => 
  [has_title] => 1
  [title_label] => Title
  [custom] => 1
  [modified] => 1
  [locked] => 0
  [disabled] => 0
  [orig_type] => article
  [disabled_changed] => 
)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM