Thursday 7 December 2017

Drupal 8 list all node types programatically

$types = \Drupal::entityTypeManager()
->getStorage('node_type')
->loadMultiple();
$nodeTypes = ! empty($types) ? array_keys($types) : [];

echo '<pre>';print_r($nodeTypes);echo '</pre>';

Source: drupal.stackexchange answer

No comments:

Post a Comment

Parenting tips to inculcate learning habits in your kid

Parenting tips to inculcate learning habits in your kid Tip #1) Children do not learn things, they emitate. So, try to do things by yours...