You are here

public function HierarchyManager::hierarchyDefaultRecord in Entity Reference Hierarchy 8

Create a default object for a new hierarchy item.

Parameters

int/null $cnid: The child node id.

int/null $pnid: The parent node id.

Return value

object The new hierarchy item.

Overrides HierarchyManagerInterface::hierarchyDefaultRecord

See also

entity_hierarchy_node_prepare_form

File

src/HierarchyManager.php, line 184
Contains \Drupal\entity_hierarchy\HierarchyManager.

Class

HierarchyManager
Defines a hierarchy manager.

Namespace

Drupal\entity_hierarchy

Code

public function hierarchyDefaultRecord($cnid = NULL, $pnid = NULL) {
  return (object) array(
    'pnid' => $pnid,
    // Todo: should this be cweight???
    'weight' => 0,
    'cnid' => $cnid,
  );
}