You are here

public function EntityUsageInterface::listUsage in Entity Usage 8

Same name and namespace in other branches
  1. 8.4 src/EntityUsageInterface.php \Drupal\entity_usage\EntityUsageInterface::listUsage()
  2. 8.2 src/EntityUsageInterface.php \Drupal\entity_usage\EntityUsageInterface::listUsage()

Determines where an entity is used.

Examples:

  • Return example 1:

[ 'node' => [ 123 => 1, 124 => 1, ], 'user' => [ 2 => 1, ], ]

  • Return example 2:

[ 'entity_reference' => [ 'node' => [...], 'user' => [...], ] ]

Parameters

\Drupal\Core\Entity\EntityInterface $entity: A target (referenced) entity.

bool $include_method: (optional) Whether the results must be wrapped into an additional array level, by the reference method. Defaults to FALSE.

Return value

array A nested array with usage data. The first level is keyed by the type of the referencing entities, the second by the referencing objects id. The value of the second level contains the usage count. Note that if $include_method is TRUE, the first level is keyed by the reference method, and the second level will continue as explained above.

1 method overrides EntityUsageInterface::listUsage()
EntityUsage::listUsage in src/EntityUsage.php
Determines where an entity is used.

File

src/EntityUsageInterface.php, line 107

Class

EntityUsageInterface
Entity usage interface.

Namespace

Drupal\entity_usage

Code

public function listUsage(EntityInterface $entity, $include_method = FALSE);