You are here

public function HierarchyOutlineStorage::hierarchyLoadParentNextChildWeight in Entity Reference Hierarchy 8

Get the next child weight for a given pnid.

Overrides HierarchyOutlineStorageInterface::hierarchyLoadParentNextChildWeight

File

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

Class

HierarchyOutlineStorage
Defines a storage class for hierarchies outline.

Namespace

Drupal\entity_hierarchy

Code

public function hierarchyLoadParentNextChildWeight($pnid) {
  $out = db_query('SELECT MAX(cweight) FROM {entity_hierarchy} WHERE pnid = :pnid', array(
    ':pnid' => $pnid,
  ))
    ->fetchField();
  if ($out !== NULL) {
    $out += 1;
  }
  else {
    $out = 0;
  }
  return $out;
}