列出CCK字段,以获取的内容类型的CCK字段列表,我希望能使用:如何通过内容类型在Drupal
drupal_get_schema('content_type_mycontenttype');
但省去了多个值的字段。有没有简单的电话来获得这样的清单?
列出CCK字段,以获取的内容类型的CCK字段列表,我希望能使用:如何通过内容类型在Drupal
drupal_get_schema('content_type_mycontenttype');
但省去了多个值的字段。有没有简单的电话来获得这样的清单?
看看content_fields函数,如果没有你需要的信息,有_content_type_info。
此外,一旦您拥有字段信息,则可以使用content_database_info提取表格存储和列名称。
我用这样的事情之前做的CCK现场信息的快速列表的内容类型:
$mytype = 'article';
$contentinfo = _content_type_info();
$output .= "<ul>";
foreach($contentinfo['fields'] as $field) {
if ($field['type_name'] == $mytype) {
$output .= '<li id="field-' . $field['field_name'] . '">' . $field['widget']['label'] . '<br>';
if ($field['widget']['description']) {
$output .= $field['widget']['description'] . '<br>';
}
$output .= '<ul>
<li>Content Types: ' . $field['type_name'] . '</li>
<li>Type: ' . $field['type'] . '</li>
<li>' . $field['field_name'] . '</li>
</ul>';
}
}
$output .= '</ul>';
为Drupal 7,检查出field_info_instances函数检索的字段列表特定节点内容类型。
下面是一个示例用法,它将检索节点内容类型的所有字段。
$ my_content_type_fields = field_info_instances(“node”,“my_node_content_type”);
感谢D7提示 – Varshith 2013-05-23 08:40:00
就是这样,谢谢。 – lazysoundsystem 2010-06-07 19:04:39