我有一个创建2内容类型,例如
Finance Form
HR_content_Form
然后现在包括文章和页面的我有4种内容类型
Article
Basic Page
Finance Form
HR_content_Form
然后我在财务表格和HR_content_Form下添加了内容。现在我想在内容类型下显示所有内容,所以我尝试了
$types = \Drupal::entityTypeManager()
->getStorage('node_type')
->loadMultiple();
foreach ($types as $machine_name => $content_type) {
$label[] = $content_type->label();
}
echo '<pre>';print_r($label);
现在显示所有内容类型。如何在财务表格HR_content_Form下显示我添加的数据。请帮助我
答案 0 :(得分:0)
您可以loadByProperties
。
$types = \Drupal::entityTypeManager()
->getStorage('node_type')
->loadByProperties(['type' => ['finance_form', 'hr_content_form']]);
答案 1 :(得分:0)
SELECT node_field_data.langcode AS node_field_data_langcode, node_field_data.created AS node_field_data_created, node_field_data.nid AS nid
FROM
{node_field_data} node_field_data
WHERE (node_field_data.status = '1') AND (node_field_data.type IN ('finance_form', 'hr_content_form'))
ORDER BY node_field_data_created DESC
LIMIT 11 OFFSET 0