You are here

public function NodeStorage::countDefaultLanguageRevisions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/NodeStorage.php \Drupal\node\NodeStorage::countDefaultLanguageRevisions()

Counts the number of revisions in the default language.

Parameters

\Drupal\node\NodeInterface: The node entity.

Return value

int The number of revisions in the default language.

Overrides NodeStorageInterface::countDefaultLanguageRevisions

File

core/modules/node/src/NodeStorage.php, line 45
Contains \Drupal\node\NodeStorage.

Class

NodeStorage
Defines the controller class for nodes.

Namespace

Drupal\node

Code

public function countDefaultLanguageRevisions(NodeInterface $node) {
  return $this->database
    ->query('SELECT COUNT(*) FROM {node_field_revision} WHERE nid = :nid AND default_langcode = 1', array(
    ':nid' => $node
      ->id(),
  ))
    ->fetchField();
}