You are here

function entity_hierarchy_node_builder in Entity Reference Hierarchy 8

Entity form builder adds the hierarchy information to the node object. More officially, this builds an updated entity object based upon the submitted form values.

This function is called from the #entity_builders callback.

As per https://www.drupal.org/node/2420295, an entity field may be better suited to this task.

See also

entity_hierarchy_form_node_form_alter

EntityForm::buildEntity

\Drupal\Core\Entity\ContentEntityBase

core/lib/Drupal/Core/Entity/ContentEntityBase.php

1 string reference to 'entity_hierarchy_node_builder'
entity_hierarchy_form_node_form_alter in ./entity_hierarchy.module
Implements Adds a vertical tab to the node form allowing a hierarchy parent to be selected or deleted. Here we're doing some permission checking, then presenting the form using the HierarchyManager class. We then use an #entity_builders callback…

File

./entity_hierarchy.module, line 86
A module to make nodes hierarchical.

Code

function entity_hierarchy_node_builder($entity_type, NodeInterface $node, &$form, FormStateInterface $form_state) {
  $node->entity_hierarchy_parents = $form_state
    ->getValue('entity_hierarchy_parents');
}