1 node.module node_type_has_content($node_type)

Determine whether a node type has any data.


$node_type: Name of bundle to check for content.

Return value

TRUE if the bundle has content associated to it; FALSE otherwise.:


core/modules/node/node.module, line 3743
The core module that allows content to be submitted to the site.


function node_type_has_content($node_type) {
  $query = new EntityFieldQuery();
  $query = $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', $node_type)
    ->range(0, 1)
    // Neutralize the 'entity_field_access' query tag added by
    // field_sql_storage_field_storage_query(). The result cannot depend on the
    // access grants of the current user.

  return (bool) $query
  ->execute() || (bool) $query