You are here

public static function EntityHierarchy::create in Entity Reference Hierarchy 8.2

Same name in this branch
  1. 8.2 src/Plugin/EntityReferenceSelection/EntityHierarchy.php \Drupal\entity_hierarchy\Plugin\EntityReferenceSelection\EntityHierarchy::create()
  2. 8.2 modules/entity_hierarchy_workbench_access/src/Plugin/AccessControlHierarchy/EntityHierarchy.php \Drupal\entity_hierarchy_workbench_access\Plugin\AccessControlHierarchy\EntityHierarchy::create()
Same name and namespace in other branches
  1. 3.x src/Plugin/EntityReferenceSelection/EntityHierarchy.php \Drupal\entity_hierarchy\Plugin\EntityReferenceSelection\EntityHierarchy::create()

Creates an instance of the plugin.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The container to pull out services used in the plugin.

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Return value

static Returns an instance of this plugin.

Overrides DefaultSelection::create

File

src/Plugin/EntityReferenceSelection/EntityHierarchy.php, line 41

Class

EntityHierarchy
Defines a class for entity reference selection that includes lineage.

Namespace

Drupal\entity_hierarchy\Plugin\EntityReferenceSelection

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {

  /** @var self $instance */
  $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
  $instance->entityTreeNodeMapper = $container
    ->get('entity_hierarchy.entity_tree_node_mapper');
  $instance->keyFactory = $container
    ->get('entity_hierarchy.nested_set_node_factory');
  $instance->nestedSetStorageFactory = $container
    ->get('entity_hierarchy.nested_set_storage_factory');
  return $instance;
}