I have a create 2 Content type like
Finance Form
HR_content_Form
Then NOw including article and page i have 4 content type
Article
Basic Page
Finance Form
HR_content_Form
Then i have added content under Finance Form and HR_content_Form.Now i want to display all content under content type so i tried
$types = \Drupal::entityTypeManager()
->getStorage('node_type')
->loadMultiple();
foreach ($types as $machine_name => $content_type) {
$label[] = $content_type->label();
}
echo '<pre>';print_r($label);
Now it display all content type. How can i display datas i have added under Finance Form ,HR_content_Form .Please help me
You can loadByProperties
.
$types = \Drupal::entityTypeManager()
->getStorage('node_type')
->loadByProperties(['type' => ['finance_form', 'hr_content_form']]);
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.