You are here

interface TreeBuilderInterface in Entity Reference Tree Widget 8

Same name and namespace in other branches
  1. 2.x src/Tree/TreeBuilderInterface.php \Drupal\entity_reference_tree\Tree\TreeBuilderInterface

Provides an interface for a tree builder.

Hierarchy

Expanded class hierarchy of TreeBuilderInterface

All classes that implement TreeBuilderInterface

File

src/Tree/TreeBuilderInterface.php, line 10

Namespace

Drupal\entity_reference_tree\Tree
View source
interface TreeBuilderInterface {

  /**
   * Load all entities from an entity bundle for the tree.
   *
   * @param string $entityType
   *   The type of the entity.
   *
   * @param string $bundleID
   *   The bundle ID.
   *
   * @return array
   *   All entities in the entity bundle.
   */
  public function loadTree(string $entityType, string $bundleID, string $langCode = NULL, int $parent = 0, int $max_depth = NULL);

  /**
   * Create a tree node.
   *
   * @param $entity
   *   The entity for the tree node.
   *
   * @param array $selected
   *   A anrray for all selected nodes.
   *
   * @return array
   *   The tree node for the entity.
   */
  public function createTreeNode($entity, array $selected = []);

  /**
   * Get the ID of a tree node.
   *
   * @param $entity
   *   The entity for the tree node.
   *
   * @return string|int|null
   *   The id of the tree node for the entity.
   */
  public function getNodeId($entity);

}

Members

Namesort descending Modifiers Type Description Overrides
TreeBuilderInterface::createTreeNode public function Create a tree node. 2
TreeBuilderInterface::getNodeId public function Get the ID of a tree node. 2
TreeBuilderInterface::loadTree public function Load all entities from an entity bundle for the tree. 2