You are here

class EntityHierarchyHandler in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 src/Handler/EntityHierarchyHandler.php \Drupal\entity_hierarchy\Handler\EntityHierarchyHandler

Defines a class for provide entity-type specific entity hierarchy logic.

Hierarchy

Expanded class hierarchy of EntityHierarchyHandler

1 file declares its use of EntityHierarchyHandler
entity_hierarchy.module in ./entity_hierarchy.module
A module to make entities hierarchical.

File

src/Handler/EntityHierarchyHandler.php, line 12

Namespace

Drupal\entity_hierarchy\Handler
View source
class EntityHierarchyHandler implements EntityHierarchyHandlerInterface {

  /**
   * {@inheritdoc}
   */
  public function getAddChildUrl(EntityTypeInterface $entityType, ContentEntityInterface $parent, $bundle, $fieldName) {
    $routeName = "entity.{$entityType->id()}.add_form";
    return Url::fromRoute($routeName, [
      $entityType
        ->getKey('bundle') => $bundle,
    ], [
      'query' => [
        $fieldName => $parent
          ->id(),
      ],
    ]);
  }

}

Members