class NestedSetNodeKeyFactory in Entity Reference Hierarchy 8.2
Same name and namespace in other branches
- 3.x src/Storage/NestedSetNodeKeyFactory.php \Drupal\entity_hierarchy\Storage\NestedSetNodeKeyFactory
Defines a class for turning Drupal entities into nested set nodes.
Hierarchy
- class \Drupal\entity_hierarchy\Storage\NestedSetNodeKeyFactory
Expanded class hierarchy of NestedSetNodeKeyFactory
9 files declare their use of NestedSetNodeKeyFactory
- ChildEntityWarningBuilder.php in src/
Information/ ChildEntityWarningBuilder.php - ChildOfMicrositeLookup.php in modules/
entity_hierarchy_microsite/ src/ ChildOfMicrositeLookup.php - EntityHierarchy.php in src/
Plugin/ EntityReferenceSelection/ EntityHierarchy.php - EntityHierarchy.php in modules/
entity_hierarchy_workbench_access/ src/ Plugin/ AccessControlHierarchy/ EntityHierarchy.php - EntityHierarchyArgumentPluginBase.php in src/
Plugin/ views/ argument/ EntityHierarchyArgumentPluginBase.php
1 string reference to 'NestedSetNodeKeyFactory'
1 service uses NestedSetNodeKeyFactory
File
- src/
Storage/ NestedSetNodeKeyFactory.php, line 11
Namespace
Drupal\entity_hierarchy\StorageView source
class NestedSetNodeKeyFactory {
/**
* Creates a new node from an entity.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* Entity to convert into nested set node.
*
* @return \PNX\NestedSet\NodeKey
* New node.
*/
public function fromEntity(ContentEntityInterface $entity) {
$id = $entity
->id();
if (!($revision_id = $entity
->getRevisionId())) {
if (!($revision_id = $entity
->getLoadedRevisionId())) {
$revision_id = $id;
}
}
return new NodeKey($id, $revision_id);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NestedSetNodeKeyFactory:: |
public | function | Creates a new node from an entity. |