如何在Drupal中按内容类型列出CCK字段

如何在Drupal中按内容类型列出CCK字段,drupal,drupal-6,cck,Drupal,Drupal 6,Cck,要获取内容类型的cck字段列表,我希望使用: drupal_get_schema('content_type_mycontenttype'); 但这会遗漏具有多个值的字段。有没有一个简单的调用可以用来获取这样一个列表?看看这个函数,如果它没有您需要的信息,那么就有了 此外,获得字段信息后,可以使用提取表存储和列名。我以前使用过类似的方法来快速列出内容类型的CCK字段信息: $mytype = 'article'; $contentinfo = _content_type_inf

要获取内容类型的cck字段列表,我希望使用:

drupal_get_schema('content_type_mycontenttype');
但这会遗漏具有多个值的字段。有没有一个简单的调用可以用来获取这样一个列表?

看看这个函数,如果它没有您需要的信息,那么就有了


此外,获得字段信息后,可以使用提取表存储和列名。

我以前使用过类似的方法来快速列出内容类型的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>';
$mytype='article';
$contentinfo=\u content\u type\u info();
$output.=“
    ”; foreach($contentinfo['fields']作为$field){ 如果($field['type\u name']==$mytype){ $output.='
  • 。$field['widget']['label'.
    '; 如果($field['widget']['description'])){ $output.=$field['widget']['description'].
    ; } $output.='
    • 内容类型:'.$field['type_name'].'
    • 类型:'.$field['Type'].'
    • “.$field['field_name']”
    '; } } $output.='
';
对于Drupal 7,请查看函数以检索特定节点内容类型的字段列表

下面是一个示例用法,它将检索节点内容类型的所有字段

$my_content_type_fields=字段信息_实例(“节点”、“my_node_content_type”)