You are here

function HierarchyOutlineStorage::hierarchyGetNodeChildrenCount in Entity Reference Hierarchy 8

Count the children of the given node.

File

src/HierarchyOutlineStorage.php, line 143
Definition of Drupal\entity_hierarchy\HierarchyOutlineStorage.

Class

HierarchyOutlineStorage
Defines a storage class for hierarchies outline.

Namespace

Drupal\entity_hierarchy

Code

function hierarchyGetNodeChildrenCount($node) {

  //    dsm($node);
  $pnid = $node;
  if (is_object($node)) {
    $pnid = $node
      ->id();
  }
  return (int) db_query("SELECT count(*) FROM {entity_hierarchy} WHERE pnid = :pnid", array(
    ':pnid' => $pnid,
  ))
    ->fetchField();
}