You are here

public static function HierarchyChildrenForm::create in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 src/Form/HierarchyChildrenForm.php \Drupal\entity_hierarchy\Form\HierarchyChildrenForm::create()

Instantiates a new instance of this class.

This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this instance should use.

Overrides ContentEntityForm::create

File

src/Form/HierarchyChildrenForm.php, line 63

Class

HierarchyChildrenForm
Defines a form for re-ordering children.

Namespace

Drupal\entity_hierarchy\Form

Code

public static function create(ContainerInterface $container) {

  /** @var self $instance */
  $instance = parent::create($container);
  $instance->nestedSetStorageFactory = $container
    ->get('entity_hierarchy.nested_set_storage_factory');
  $instance->nodeKeyFactory = $container
    ->get('entity_hierarchy.nested_set_node_factory');
  $instance->parentCandidate = $container
    ->get('entity_hierarchy.information.parent_candidate');
  $instance->entityTreeNodeMapper = $container
    ->get('entity_hierarchy.entity_tree_node_mapper');
  return $instance;
}