You are here

EntityUsageSourceLevelInterface.php in Entity Usage 8.3

File

src/EntityUsageSourceLevelInterface.php
View source
<?php

namespace Drupal\entity_usage;

use Drupal\Core\Entity\EntityInterface;

/**
 * Defines the interface for the service managing top-level source entities.
 */
interface EntityUsageSourceLevelInterface {

  /**
   * Checks whether an entity is a top-level entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity object we are dealing with.
   *
   * @return bool
   *   TRUE if the entity passed in is a top-level entity, FALSE otherwise.
   */
  public static function isTopLevel(EntityInterface $entity);

  /**
   * Checks whether an entity is a middle-level entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity object we are dealing with.
   *
   * @return bool
   *   TRUE if the entity passed in is a middle-level entity, FALSE otherwise.
   */
  public static function isMiddleLevel(EntityInterface $entity);

  /**
   * Checks whether an entity is a bottom-level entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity object we are dealing with.
   *
   * @return bool
   *   TRUE if the entity passed in is a bottom-level entity, FALSE otherwise.
   */
  public static function isBottomLevel(EntityInterface $entity);

  /**
   * Returns all entity type names that are defined as top-level (sources).
   *
   * @return string[]
   *   An indexed array of top-level entity type machine names.
   */
  public static function getTopLevelEntityTypes();

  /**
   * Returns all entity type names that are defined as middle-level.
   *
   * @return string[]
   *   An indexed array of middle-level entity type machine names.
   */
  public static function getMiddleLevelEntityTypes();

  /**
   * Returns all entity type names that are defined as bottom-level (targets).
   *
   * @return string[]
   *   An indexed array of bottom-level entity type machine names.
   */
  public static function getBottomLevelEntityTypes();

}

Interfaces

Namesort descending Description
EntityUsageSourceLevelInterface Defines the interface for the service managing top-level source entities.